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