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

Last change on this file since 211 was 211, checked in by Faria Nassiri Mofakham, 6 years ago

For keeping track (Shapes added, several changes to Product, Portfolio, Main, and GUI classes; contains some errors) to return back after some more changes.

File size: 2.0 KB
Line 
1package negotiator.onetomany;
2
3import java.awt.Color;
4import java.awt.Point;
5//import java.util.Iterator;
6
7//import javax.swing.*;
8//import java.awt.*;
9
10
11import javax.swing.JButton;
12import javax.swing.JCheckBox;
13import javax.swing.JFrame;
14import javax.swing.JLabel;
15import javax.swing.JPasswordField;
16
17import negotiator.onetomany.etc.Circle;
18import negotiator.onetomany.etc.Square;
19import net.miginfocom.swing.MigLayout;
20
21/**
22 * @author Faria Nassiri-Mofakham
23 *
24 */
25public 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}
Note: See TracBrowser for help on using the repository browser.