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

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