source: src/main/java/negotiator/onetomany/GUITest.java@ 220

Last change on this file since 220 was 215, checked in by Faria Nassiri Mofakham, 6 years ago
File size: 2.7 KB
Line 
1package negotiator.onetomany;
2
3import javax.swing.*;
4import java.awt.*;
5import java.awt.geom.*;
6
7class GUITest extends JFrame{
8
9 public GUITest(){
10 JPanel panel=new JPanel();
11 getContentPane().add(panel);
12 setSize(450,450);
13
14 JButton button =new JButton("press");
15 panel.add(button);
16 }
17
18 public void paint(Graphics g) {
19 super.paint(g); // fixes the immediate problem.
20 Graphics2D g2 = (Graphics2D) g;
21 g2.setColor(Color.gray);
22 Line2D lin = new Line2D.Float(100, 100, 500, 100);
23 g2.draw(lin);
24 }
25
26 public static void main(String []args){
27 GUITest s=new GUITest();
28 s.setVisible(true);
29 }
30}
31
32
33//package negotiator.onetomany;
34//
35//import java.awt.Color;
36//import java.awt.Graphics;
37//import java.awt.Point;
38////import java.util.Iterator;
39//
40////import javax.swing.*;
41////import java.awt.*;
42//
43//
44//import javax.swing.JButton;
45//import javax.swing.JCheckBox;
46//import javax.swing.JFrame;
47//import javax.swing.JLabel;
48//import javax.swing.JPasswordField;
49//
50//import negotiator.onetomany.etc.Circle;
51//import net.miginfocom.swing.MigLayout;
52//
53///**
54// * @author Faria Nassiri-Mofakham
55// *
56// */
57//public class GUITest extends JFrame
58//{
59// Main main;
60//
61// public GUITest(Main m)
62// {
63// super("MigLayout Basic");
64// main = m;
65//
66// int squareDimension = 100;
67// int circleRadius = 5;
68//
69// // Point n = new Point(100,200);
70// int[] spans = {0, 50, 100, 150, 200, 250, 300};
71//
72// // Show the GUI
73// setLayout(new MigLayout("", "[grow]", "[grow]"));
74//
75//
76//// showPortfolioBorder(squareDimension);
77//
78//// showPortfolio(circleRadius);
79//
80//
81// // add(new JLabel("Portfolio:"), "right, wrap");
82// //
83// // //draw square border for product portfolio
84// // Square s = new Square(null,squareDimension, Color.BLACK);
85// // super.paint(s);
86// //
87// // //draw colored dots
88// // for (int i=0; i<p.size(); i++)
89// // {
90// // Portfolio p = main.getPortfolio();
91// // Circle c = new Circle(null,circleRadius, p.getProduct(i));
92// // super.paint(c);
93// // }
94//
95//
96// setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
97// pack();
98// setLocationRelativeTo(null);
99// setVisible(true);
100// }
101//
102//
103//
104//// public void showPortfolio(int circleRadius)
105//// {
106//// for (int i=0; i<p.size(); i++)
107//// {
108//// Portfolio p = main.getPortfolio();
109//// Circle c = new Circle(null,circleRadius, p.getProduct(i).getColor());
110//// super.paint(c); // <--- here
111//// }
112//// }
113//
114// public static void main(String[] args)
115// {
116// Main main = new Main();
117// GUITest gui = new GUITest(main);
118//
119// }
120//
121//}
122//
Note: See TracBrowser for help on using the repository browser.