1 | package negotiator.onetomany;
|
---|
2 |
|
---|
3 | import java.awt.Canvas;
|
---|
4 | import java.awt.Color;
|
---|
5 | import java.awt.Dimension;
|
---|
6 | import java.awt.Font;
|
---|
7 | import java.awt.Image;
|
---|
8 | import java.awt.Toolkit;
|
---|
9 |
|
---|
10 | import javax.swing.JButton;
|
---|
11 | import javax.swing.JComponent;
|
---|
12 | import javax.swing.JFrame;
|
---|
13 | import javax.swing.JLabel;
|
---|
14 | import javax.swing.JPanel;
|
---|
15 |
|
---|
16 | import negotiator.onetomany.etc.Bob;
|
---|
17 | import negotiator.onetomany.etc.Drawing;
|
---|
18 | import negotiator.onetomany.etc.Line;
|
---|
19 | //import negotiator.onetomany.etc.Line;
|
---|
20 | import net.miginfocom.swing.MigLayout;
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * @author Faria Nassiri-Mofakham
|
---|
24 | *
|
---|
25 | */
|
---|
26 | public class GUI extends JFrame
|
---|
27 | {
|
---|
28 | Main main;
|
---|
29 | private static final long serialVersionUID = -5602032021645365870L;
|
---|
30 |
|
---|
31 |
|
---|
32 | public GUI(Main m) //throws MalformedURLException, IOException
|
---|
33 | {
|
---|
34 | super("Bob gets ready for negotiation ...");
|
---|
35 | main = m;
|
---|
36 |
|
---|
37 |
|
---|
38 | // Show the GUI
|
---|
39 | setLayout(new MigLayout("", "", ""));
|
---|
40 |
|
---|
41 | // how to change to url address of Bob ? "./NegotiatorGUI/src/main/java/negotiator/onetomany/etc/Bob.png"
|
---|
42 | Canvas canvas0 = new Bob("C:\\Users\\fnm\\eclipse-workspace\\NegotiatorGUI\\src\\main\\java\\negotiator\\onetomany\\etc\\Bob.png");
|
---|
43 | // Canvas canvas0 = new Bob("NegotiatorGUI.src.main.java.negotiator.onetomany.etc.Bob.png");
|
---|
44 | canvas0.setSize(400, 200);
|
---|
45 |
|
---|
46 | add(canvas0, "growx, center, wrap"); //cannot make it center
|
---|
47 |
|
---|
48 | add(new JLabel(" "), "center, wrap");
|
---|
49 |
|
---|
50 |
|
---|
51 | //defining a font
|
---|
52 | Font f1 = new Font("TimesRoman",Font.BOLD,20);
|
---|
53 | Font f2 = new Font("TimesRoman",Font.ITALIC,20);
|
---|
54 |
|
---|
55 |
|
---|
56 | JLabel l1_1 = new JLabel("The `Agent' receives Bob's PORTFOLIO as follows:");
|
---|
57 | l1_1.setFont(f2);
|
---|
58 | //l1_1.setForeground(Color.GRAY);
|
---|
59 | add(l1_1, "center, wrap");
|
---|
60 |
|
---|
61 |
|
---|
62 | Canvas canvas1 = new Drawing(m.getPortfolio());
|
---|
63 | canvas1.setSize(200, 200);
|
---|
64 | add(canvas1, "growx, center, wrap");
|
---|
65 |
|
---|
66 |
|
---|
67 | //a line
|
---|
68 | Canvas canvas2 = new Line(Color.BLACK,800);
|
---|
69 | canvas2.setSize(1, 1);
|
---|
70 | add(canvas2, "growx, center, wrap");
|
---|
71 |
|
---|
72 | JLabel l2 = new JLabel("It also receives Bob's DEMAND PLAN as follows:");
|
---|
73 | l2.setFont(f1);
|
---|
74 | add(l2, "center, wrap");
|
---|
75 |
|
---|
76 | // Canvas canvas2 = new Drawing(m.getDemandPlan());
|
---|
77 | // canvas2.setSize(200, 200);
|
---|
78 | // add(canvas2, "center");
|
---|
79 |
|
---|
80 |
|
---|
81 | // Canvas canvas2 = new Drawing(m.getPortfolio());
|
---|
82 | // canvas2.setSize(200, 200);
|
---|
83 | // add(canvas2, "growx, growy, center, wrap");
|
---|
84 | //
|
---|
85 |
|
---|
86 | // //a line
|
---|
87 | // Canvas canvas4 = new Line(Color.BLACK,800);
|
---|
88 | // canvas4.setSize(1, 1);
|
---|
89 | // add(canvas4, "growx, center, wrap");
|
---|
90 |
|
---|
91 | //buttons
|
---|
92 | add(new JButton("Edit..."), "cell 0 10, center, w 90");
|
---|
93 | add(new JButton("Delete..."), "cell 0 10, center, w 90");
|
---|
94 | add(new JButton("Next..."), "cell 0 10,center, w 90");
|
---|
95 | add(new JButton("Close"), "cell 0 10, center, wrap, w 90");
|
---|
96 |
|
---|
97 | //setting the background as the Bob's image
|
---|
98 | getContentPane().setBackground(Color.decode("#AFD6D6"));
|
---|
99 |
|
---|
100 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
---|
101 | pack();
|
---|
102 |
|
---|
103 | setLocationRelativeTo(null);
|
---|
104 | // Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
---|
105 | // setBounds(0,0,screenSize.width, screenSize.height);
|
---|
106 | setVisible(true);
|
---|
107 | }
|
---|
108 |
|
---|
109 | /**
|
---|
110 | * @param args
|
---|
111 | */
|
---|
112 | public static void main(String[] args)
|
---|
113 | {
|
---|
114 | Main main = new Main();
|
---|
115 | GUI gui = new GUI(main);
|
---|
116 |
|
---|
117 | }
|
---|
118 |
|
---|
119 | }
|
---|
120 |
|
---|
121 |
|
---|