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