1 | package negotiator.onetomany;
|
---|
2 |
|
---|
3 | import java.awt.Color;
|
---|
4 | import java.awt.Graphics;
|
---|
5 | import java.awt.Point;
|
---|
6 | //import java.util.Iterator;
|
---|
7 |
|
---|
8 | //import javax.swing.*;
|
---|
9 | //import java.awt.*;
|
---|
10 |
|
---|
11 |
|
---|
12 | import javax.swing.JButton;
|
---|
13 | import javax.swing.JCheckBox;
|
---|
14 | import javax.swing.JFrame;
|
---|
15 | import javax.swing.JLabel;
|
---|
16 | import javax.swing.JPasswordField;
|
---|
17 |
|
---|
18 | import negotiator.onetomany.etc.Circle;
|
---|
19 | import negotiator.onetomany.etc.Square;
|
---|
20 | import net.miginfocom.swing.MigLayout;
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * @author Faria Nassiri-Mofakham
|
---|
24 | *
|
---|
25 | */
|
---|
26 | public class GUITest extends JFrame
|
---|
27 | {
|
---|
28 | Main main;
|
---|
29 |
|
---|
30 | public GUITest(Main m)
|
---|
31 | {
|
---|
32 | super("MigLayout Basic");
|
---|
33 | main = m;
|
---|
34 |
|
---|
35 | int squareDimension = 100;
|
---|
36 | int circleRadius = 5;
|
---|
37 |
|
---|
38 | // Point n = new Point(100,200);
|
---|
39 | int[] spans = {0, 50, 100, 150, 200, 250, 300};
|
---|
40 |
|
---|
41 | // Show the GUI
|
---|
42 | setLayout(new MigLayout("", "[grow]", "[grow]"));
|
---|
43 |
|
---|
44 |
|
---|
45 | showPortfolioBorder(squareDimension);
|
---|
46 |
|
---|
47 | // showPortfolio(circleRadius);
|
---|
48 |
|
---|
49 |
|
---|
50 | // add(new JLabel("Portfolio:"), "right, wrap");
|
---|
51 | //
|
---|
52 | // //draw square border for product portfolio
|
---|
53 | // Square s = new Square(null,squareDimension, Color.BLACK);
|
---|
54 | // super.paint(s);
|
---|
55 | //
|
---|
56 | // //draw colored dots
|
---|
57 | // for (int i=0; i<p.size(); i++)
|
---|
58 | // {
|
---|
59 | // Portfolio p = main.getPortfolio();
|
---|
60 | // Circle c = new Circle(null,circleRadius, p.getProduct(i));
|
---|
61 | // super.paint(c);
|
---|
62 | // }
|
---|
63 |
|
---|
64 |
|
---|
65 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
---|
66 | pack();
|
---|
67 | setLocationRelativeTo(null);
|
---|
68 | setVisible(true);
|
---|
69 | }
|
---|
70 |
|
---|
71 | /**
|
---|
72 | * @param args
|
---|
73 | */
|
---|
74 | public void showPortfolioBorder(int squareDimension)
|
---|
75 | {
|
---|
76 | add(new JLabel("Portfolio:"), "right, wrap");
|
---|
77 |
|
---|
78 | //draw square border for product portfolio
|
---|
79 | Square s = new Square(null,squareDimension, Color.BLACK);
|
---|
80 | // super.paint(s);
|
---|
81 | // Graphics g = new Graphics(0,0,squareDimension,squareDimension); // <-- and changes to this
|
---|
82 | Graphics g = getGraphics();
|
---|
83 | s.paint(g, Color.BLACK);
|
---|
84 |
|
---|
85 |
|
---|
86 | }
|
---|
87 |
|
---|
88 | // public void showPortfolio(int circleRadius)
|
---|
89 | // {
|
---|
90 | // for (int i=0; i<p.size(); i++)
|
---|
91 | // {
|
---|
92 | // Portfolio p = main.getPortfolio();
|
---|
93 | // Circle c = new Circle(null,circleRadius, p.getProduct(i).getColor());
|
---|
94 | // super.paint(c); // <--- here
|
---|
95 | // }
|
---|
96 | // }
|
---|
97 |
|
---|
98 | public static void main(String[] args)
|
---|
99 | {
|
---|
100 | Main main = new Main();
|
---|
101 | GUITest gui = new GUITest(main);
|
---|
102 |
|
---|
103 | }
|
---|
104 |
|
---|
105 | }
|
---|
106 |
|
---|