source: src/main/java/negotiator/onetomany/GUI.java@ 218

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

In these last versions, GUI and Main updated (and with changes in background color), Line could not be shown yet (between the parts of the window), Bob image could not be shown yet, some changes in DemanPlan started...

File size: 3.4 KB
Line 
1package negotiator.onetomany;
2
3import java.awt.Canvas;
4import java.awt.Color;
5
6import javax.swing.JButton;
7import javax.swing.JFrame;
8import javax.swing.JLabel;
9
10
11import negotiator.onetomany.etc.Bob;
12import negotiator.onetomany.etc.Drawing;
13//import negotiator.onetomany.etc.Line;
14import net.miginfocom.swing.MigLayout;
15
16/**
17 * @author Faria Nassiri-Mofakham
18 *
19 */
20public class GUI extends JFrame
21{
22 Main main;
23 private static final long serialVersionUID = -5602032021645365870L;
24
25
26 public GUI(Main m) //throws MalformedURLException, IOException
27 {
28 super("Bob gets ready for negotiation ...");
29 main = m;
30
31
32 // Show the GUI
33 setLayout(new MigLayout("", "", ""));
34
35
36 //add(new JImageComponent("/NegotiatorGUI/src/main/java/negotiator/onetomany/etc/Bob.png"), "growx, center, wrap");
37
38
39// Canvas canvas0 = new Bob("/NegotiatorGUI/src/main/java/negotiator/onetomany/etc/Bob.png");
40// canvas0.setSize(300, 300);
41// add(canvas0, "growx, center, wrap");
42
43
44
45
46 add(new JLabel("`Rational Assistant' receives Bob's PORTFOLIO as follows:"), "center, wrap");
47
48
49 Canvas canvas1 = new Drawing(m.getPortfolio());
50 canvas1.setSize(200, 200);
51 add(canvas1, "growx, center, wrap");
52
53 //add(new Line()); // for drawing a line!
54 //add(new Line2D.Float(100, 100, 400, 100), "center");
55
56 add(new JLabel("--------------------------------------------------------------------------------------------------"), "center, wrap, w 100");
57
58 add(new JLabel("It also receives Bob's DEMAND PLAN as follows:"), "center, wrap");
59
60 // Canvas canvas2 = new Drawing(m.getDemandPlan());
61 // canvas2.setSize(200, 200);
62 // add(canvas2, "center");
63
64 Canvas canvas2 = new Drawing(m.getPortfolio());
65 canvas2.setSize(200, 200);
66 add(canvas2, "growx, growy, center, wrap");
67
68 add(new JLabel("--------------------------------------------------------------------------------------------------"), "center, wrap, w 100");
69
70
71 //*********************
72 add(new JButton("Edit..."), "cell 0 10, center, w 90");
73 add(new JButton("Delete..."), "cell 0 10, center, w 90");
74 add(new JButton("Next..."), "cell 0 10,center, w 90");
75 add(new JButton("Close"), "cell 0 10, center, wrap, w 90");
76
77
78
79 getContentPane().setBackground(Color.decode("#AFD6D6"));
80
81
82 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
83 pack();
84
85
86 setLocationRelativeTo(null);
87 setVisible(true);
88 }
89
90 /**
91 * @param args
92 */
93 public static void main(String[] args)
94 {
95 Main main = new Main();
96 GUI gui = new GUI(main);
97
98 }
99
100}
101
102//import java.awt.geom.Line2D;
103//import java.awt.image.BufferedImage;
104//import java.io.File;
105//import java.io.IOException;
106
107//import javax.swing.*;
108//import javax.imageio.ImageIO;
109
110//import javax.swing.ImageIcon;
111
112//import java.awt.FlowLayout;
113//import java.net.MalformedURLException;
114
115
116
117
118
119//ImageIcon ii = new ImageIcon("/NegotiatorGUI/src/main/java/negotiator/onetomany/etc/Bob.png");
120//JLabel lable = new JLabel(ii);
121//JScrollPane jsp = new JScrollPane(lable);
122//
123//getContentPane().add(jsp);
124// setSize(1000, 700);
125
126
127
128//BufferedImage img = ImageIO.read(new URL("NegotiatorGUI.src.main.java.negotiator.onetomany.etc.Bob.png"));
129//ImageIcon icon = new ImageIcon(img);
130//setLayout(new FlowLayout());
131//setSize(200, 300);
132//JLabel lbl = new JLabel();
133//lbl.setIcon(icon);
134//add(lbl);
135
136
137//canvas2.setBounds(x, y, width, height); //for changing its margin !?
Note: See TracBrowser for help on using the repository browser.