[209] | 1 | package negotiator.onetomany;
|
---|
| 2 |
|
---|
[212] | 3 | import java.awt.Canvas;
|
---|
[218] | 4 | import java.awt.Color;
|
---|
[219] | 5 | import java.awt.Dimension;
|
---|
[221] | 6 | import java.awt.Font;
|
---|
[220] | 7 | import java.awt.Image;
|
---|
[219] | 8 | import java.awt.Toolkit;
|
---|
[218] | 9 |
|
---|
[209] | 10 | import javax.swing.JButton;
|
---|
[219] | 11 | import javax.swing.JComponent;
|
---|
[209] | 12 | import javax.swing.JFrame;
|
---|
| 13 | import javax.swing.JLabel;
|
---|
[219] | 14 | import javax.swing.JPanel;
|
---|
[209] | 15 |
|
---|
[216] | 16 | import negotiator.onetomany.etc.Bob;
|
---|
[212] | 17 | import negotiator.onetomany.etc.Drawing;
|
---|
[219] | 18 | import negotiator.onetomany.etc.Line;
|
---|
[216] | 19 | //import negotiator.onetomany.etc.Line;
|
---|
[209] | 20 | import net.miginfocom.swing.MigLayout;
|
---|
| 21 |
|
---|
[210] | 22 | /**
|
---|
| 23 | * @author Faria Nassiri-Mofakham
|
---|
| 24 | *
|
---|
| 25 | */
|
---|
[209] | 26 | public class GUI extends JFrame
|
---|
| 27 | {
|
---|
| 28 | Main main;
|
---|
[216] | 29 | private static final long serialVersionUID = -5602032021645365870L;
|
---|
| 30 |
|
---|
[211] | 31 |
|
---|
[216] | 32 | public GUI(Main m) //throws MalformedURLException, IOException
|
---|
[209] | 33 | {
|
---|
[215] | 34 | super("Bob gets ready for negotiation ...");
|
---|
[209] | 35 | main = m;
|
---|
| 36 |
|
---|
[211] | 37 |
|
---|
[209] | 38 | // Show the GUI
|
---|
[215] | 39 | setLayout(new MigLayout("", "", ""));
|
---|
[211] | 40 |
|
---|
[221] | 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");
|
---|
[220] | 44 | canvas0.setSize(400, 200);
|
---|
[216] | 45 |
|
---|
[221] | 46 | add(canvas0, "growx, center, wrap"); //cannot make it center
|
---|
| 47 |
|
---|
[219] | 48 | add(new JLabel(" "), "center, wrap");
|
---|
[216] | 49 |
|
---|
[221] | 50 |
|
---|
| 51 | //defining a font
|
---|
| 52 | Font f1 = new Font("TimesRoman",Font.BOLD,20);
|
---|
| 53 | Font f2 = new Font("TimesRoman",Font.ITALIC,20);
|
---|
[215] | 54 |
|
---|
[221] | 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");
|
---|
[216] | 60 |
|
---|
| 61 |
|
---|
[215] | 62 | Canvas canvas1 = new Drawing(m.getPortfolio());
|
---|
| 63 | canvas1.setSize(200, 200);
|
---|
| 64 | add(canvas1, "growx, center, wrap");
|
---|
| 65 |
|
---|
| 66 |
|
---|
[221] | 67 | //a line
|
---|
[219] | 68 | Canvas canvas2 = new Line(Color.BLACK,800);
|
---|
| 69 | canvas2.setSize(1, 1);
|
---|
[221] | 70 | add(canvas2, "growx, center, wrap");
|
---|
[219] | 71 |
|
---|
[221] | 72 | JLabel l2 = new JLabel("It also receives Bob's DEMAND PLAN as follows:");
|
---|
| 73 | l2.setFont(f1);
|
---|
| 74 | add(l2, "center, wrap");
|
---|
[215] | 75 |
|
---|
| 76 | // Canvas canvas2 = new Drawing(m.getDemandPlan());
|
---|
| 77 | // canvas2.setSize(200, 200);
|
---|
| 78 | // add(canvas2, "center");
|
---|
| 79 |
|
---|
[216] | 80 |
|
---|
[219] | 81 | // Canvas canvas2 = new Drawing(m.getPortfolio());
|
---|
| 82 | // canvas2.setSize(200, 200);
|
---|
| 83 | // add(canvas2, "growx, growy, center, wrap");
|
---|
| 84 | //
|
---|
[218] | 85 |
|
---|
[221] | 86 | // //a line
|
---|
| 87 | // Canvas canvas4 = new Line(Color.BLACK,800);
|
---|
| 88 | // canvas4.setSize(1, 1);
|
---|
| 89 | // add(canvas4, "growx, center, wrap");
|
---|
[218] | 90 |
|
---|
[221] | 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
|
---|
[219] | 98 | getContentPane().setBackground(Color.decode("#AFD6D6"));
|
---|
[221] | 99 |
|
---|
[209] | 100 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
---|
| 101 | pack();
|
---|
[221] | 102 |
|
---|
[209] | 103 | setLocationRelativeTo(null);
|
---|
[219] | 104 | // Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
---|
| 105 | // setBounds(0,0,screenSize.width, screenSize.height);
|
---|
[209] | 106 | setVisible(true);
|
---|
| 107 | }
|
---|
[211] | 108 |
|
---|
[210] | 109 | /**
|
---|
| 110 | * @param args
|
---|
| 111 | */
|
---|
[209] | 112 | public static void main(String[] args)
|
---|
| 113 | {
|
---|
| 114 | Main main = new Main();
|
---|
| 115 | GUI gui = new GUI(main);
|
---|
[211] | 116 |
|
---|
[209] | 117 | }
|
---|
| 118 |
|
---|
[216] | 119 | }
|
---|
[211] | 120 |
|
---|
| 121 |
|
---|