[209] | 1 | package negotiator.onetomany;
|
---|
| 2 |
|
---|
[212] | 3 | import java.awt.Canvas;
|
---|
[218] | 4 | import java.awt.Color;
|
---|
| 5 |
|
---|
[209] | 6 | import javax.swing.JButton;
|
---|
| 7 | import javax.swing.JFrame;
|
---|
| 8 | import javax.swing.JLabel;
|
---|
| 9 |
|
---|
[216] | 10 |
|
---|
| 11 | import negotiator.onetomany.etc.Bob;
|
---|
[212] | 12 | import negotiator.onetomany.etc.Drawing;
|
---|
[216] | 13 | //import negotiator.onetomany.etc.Line;
|
---|
[209] | 14 | import net.miginfocom.swing.MigLayout;
|
---|
| 15 |
|
---|
[210] | 16 | /**
|
---|
| 17 | * @author Faria Nassiri-Mofakham
|
---|
| 18 | *
|
---|
| 19 | */
|
---|
[209] | 20 | public class GUI extends JFrame
|
---|
| 21 | {
|
---|
| 22 | Main main;
|
---|
[216] | 23 | private static final long serialVersionUID = -5602032021645365870L;
|
---|
| 24 |
|
---|
[211] | 25 |
|
---|
[216] | 26 | public GUI(Main m) //throws MalformedURLException, IOException
|
---|
[209] | 27 | {
|
---|
[215] | 28 | super("Bob gets ready for negotiation ...");
|
---|
[209] | 29 | main = m;
|
---|
| 30 |
|
---|
[211] | 31 |
|
---|
[209] | 32 | // Show the GUI
|
---|
[215] | 33 | setLayout(new MigLayout("", "", ""));
|
---|
[211] | 34 |
|
---|
[218] | 35 |
|
---|
[216] | 36 | //add(new JImageComponent("/NegotiatorGUI/src/main/java/negotiator/onetomany/etc/Bob.png"), "growx, center, wrap");
|
---|
[211] | 37 |
|
---|
[216] | 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 |
|
---|
[215] | 44 |
|
---|
[216] | 45 |
|
---|
| 46 | add(new JLabel("`Rational Assistant' receives Bob's PORTFOLIO as follows:"), "center, wrap");
|
---|
| 47 |
|
---|
| 48 |
|
---|
[215] | 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 |
|
---|
[216] | 58 | add(new JLabel("It also receives Bob's DEMAND PLAN as follows:"), "center, wrap");
|
---|
[215] | 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");
|
---|
[216] | 67 |
|
---|
[215] | 68 | add(new JLabel("--------------------------------------------------------------------------------------------------"), "center, wrap, w 100");
|
---|
[211] | 69 |
|
---|
[215] | 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");
|
---|
[216] | 76 |
|
---|
[218] | 77 |
|
---|
| 78 |
|
---|
| 79 | getContentPane().setBackground(Color.decode("#AFD6D6"));
|
---|
[216] | 80 |
|
---|
[218] | 81 |
|
---|
[209] | 82 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
---|
| 83 | pack();
|
---|
[218] | 84 |
|
---|
| 85 |
|
---|
[209] | 86 | setLocationRelativeTo(null);
|
---|
| 87 | setVisible(true);
|
---|
| 88 | }
|
---|
[211] | 89 |
|
---|
[210] | 90 | /**
|
---|
| 91 | * @param args
|
---|
| 92 | */
|
---|
[209] | 93 | public static void main(String[] args)
|
---|
| 94 | {
|
---|
| 95 | Main main = new Main();
|
---|
| 96 | GUI gui = new GUI(main);
|
---|
[211] | 97 |
|
---|
[209] | 98 | }
|
---|
| 99 |
|
---|
[216] | 100 | }
|
---|
[211] | 101 |
|
---|
[216] | 102 | //import java.awt.geom.Line2D;
|
---|
| 103 | //import java.awt.image.BufferedImage;
|
---|
| 104 | //import java.io.File;
|
---|
| 105 | //import java.io.IOException;
|
---|
[211] | 106 |
|
---|
[216] | 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 !?
|
---|