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