[253] | 1 | package onetomany.etc;
|
---|
[236] | 2 | //package negotiator.onetomany;
|
---|
| 3 | //
|
---|
| 4 | //import java.awt.Canvas;
|
---|
| 5 | //import java.awt.Color;
|
---|
| 6 | //import java.awt.Font;
|
---|
| 7 | //
|
---|
| 8 | //import javax.swing.BorderFactory;
|
---|
| 9 | //import javax.swing.JButton;
|
---|
| 10 | //import javax.swing.JFrame;
|
---|
| 11 | //import javax.swing.JLabel;
|
---|
| 12 | //import javax.swing.JPanel;
|
---|
| 13 | //
|
---|
| 14 | //import negotiator.onetomany.etc.PortfolioDrawing;
|
---|
| 15 | //import negotiator.onetomany.etc.DemandPlanDrawing;
|
---|
| 16 | //import negotiator.onetomany.etc.Line;
|
---|
| 17 | //import negotiator.onetomany.etc.DrawImage;
|
---|
| 18 | //import net.miginfocom.swing.MigLayout;
|
---|
| 19 | //
|
---|
| 20 | ///**
|
---|
| 21 | // * @author Faria Nassiri-Mofakham
|
---|
| 22 | // *
|
---|
| 23 | // */
|
---|
| 24 | //public class GUI extends JFrame
|
---|
| 25 | //{
|
---|
| 26 | // Main main;
|
---|
| 27 | // private static final long serialVersionUID = -5602032021645365870L;
|
---|
| 28 | //
|
---|
| 29 | //
|
---|
| 30 | // public GUI(Main m) //throws MalformedURLException, IOException
|
---|
| 31 | // {
|
---|
| 32 | // super("Bob gets ready for negotiation ...");
|
---|
| 33 | // main = m;
|
---|
| 34 | //
|
---|
| 35 | //
|
---|
| 36 | // // Show the GUI
|
---|
| 37 | // setLayout(new MigLayout("", "", ""));
|
---|
| 38 | //
|
---|
| 39 | // // Could not `resize' and show small CWI-ACUMEX QR-code
|
---|
| 40 | //// Canvas canvas00 = new PutImage("C:\\Users\\fnm\\Pictures\\qr_code.png");
|
---|
| 41 | //// canvas00.setBounds(0,0,50,50);
|
---|
| 42 | //// canvas00.setSize(50, 50);
|
---|
| 43 | //// add(canvas00);
|
---|
| 44 | //
|
---|
| 45 | //
|
---|
| 46 | // // how to change to url address of Bob ? "./NegotiatorGUI/src/main/java/negotiator/onetomany/etc/Bob.png"
|
---|
| 47 | // Canvas canvas0 = new DrawImage("C:\\Users\\fnm\\eclipse-workspace\\NegotiatorGUI\\src\\main\\java\\negotiator\\onetomany\\etc\\Bob.png");
|
---|
| 48 | //// Canvas canvas0 = new Bob("NegotiatorGUI.src.main.java.negotiator.onetomany.etc.Bob.png");
|
---|
| 49 | // canvas0.setSize(400, 200);
|
---|
| 50 | // add(canvas0, "cell 0 0, span 1 4, growx, center"); //cannot make it center
|
---|
| 51 | //
|
---|
| 52 | // //defining a font
|
---|
| 53 | // Font f1 = new Font("TimesRoman",Font.BOLD,20);
|
---|
| 54 | // Font f2 = new Font("TimesRoman",Font.ITALIC,20);
|
---|
| 55 | // Font f3 = new Font("TimesRoman",Font.PLAIN,16);
|
---|
| 56 | //
|
---|
| 57 | //
|
---|
| 58 | //// JLabel l1 = new JLabel("The `Agent' receives Bob's PORTFOLIO containing "+m.getPortfolio().size()+" different products as follows:");
|
---|
| 59 | // JLabel l1 = new JLabel("Bob's PORTFOLIO contains "+m.getPortfolio().size()+" different products as follows:");
|
---|
| 60 | // l1.setFont(f1);
|
---|
| 61 | //
|
---|
| 62 | // add(l1, "cell 1 1, center, width 100:550:1000, wrap"); // no notice to min and max constraints for column width, just the preferred (the middle number)
|
---|
| 63 | //
|
---|
| 64 | //
|
---|
| 65 | // JPanel panel1 = new JPanel();
|
---|
| 66 | // panel1.setForeground(Color.WHITE);
|
---|
| 67 | // panel1.setFont(f3);
|
---|
| 68 | //
|
---|
| 69 | // panel1.setBorder(BorderFactory.createTitledBorder("Portfolio"));
|
---|
| 70 | // panel1.setBackground(Color.decode("#5C8585"));
|
---|
[226] | 71 | // Canvas canvas1 = new PortfolioDrawing(m.getPortfolio());
|
---|
| 72 | // canvas1.setBackground(Color.decode("#5C8585"));
|
---|
[236] | 73 | // canvas1.setSize(550, 200);
|
---|
| 74 | // panel1.add(canvas1);
|
---|
| 75 | // add(panel1, "cell 1 2, growx, center, wrap");
|
---|
| 76 | //
|
---|
| 77 | //
|
---|
| 78 | //
|
---|
| 79 | //// Canvas canvas1 = new PortfolioDrawing(m.getPortfolio());
|
---|
| 80 | //// canvas1.setBackground(Color.decode("#5C8585"));
|
---|
| 81 | //// canvas1.setSize(200, 200);
|
---|
| 82 | //// add(canvas1, "cell 1 2, growx, center, wrap");
|
---|
| 83 | //
|
---|
| 84 | // add(new JLabel(" "), "center, wrap");
|
---|
| 85 | //
|
---|
| 86 | //
|
---|
| 87 | //
|
---|
| 88 | //
|
---|
| 89 | // //a line
|
---|
| 90 | // int w = (canvas0.getWidth()+canvas1.getWidth())*3; // doesn't calculate dynamically well!
|
---|
| 91 | //
|
---|
| 92 | //
|
---|
| 93 | //
|
---|
| 94 | //
|
---|
| 95 | //
|
---|
| 96 | // Canvas canvas2 = new Line(Color.BLACK,w);
|
---|
| 97 | // canvas2.setSize(1, 1);
|
---|
| 98 | // add(canvas2, "span 2 0, growx, center, wrap");
|
---|
| 99 | //
|
---|
| 100 | // add(new JLabel(" "), "center, wrap");
|
---|
| 101 | //
|
---|
| 102 | //
|
---|
| 103 | //// JLabel l2 = new JLabel("It also receives Bob's DEMAND PLAN as follows:");
|
---|
| 104 | // JLabel l2 = new JLabel("And his DEMAND has been planed as the following quantities:");
|
---|
| 105 | // l2.setFont(f1);
|
---|
| 106 | //
|
---|
| 107 | // add(l2, "span 2 0, center, wrap");
|
---|
| 108 | //
|
---|
| 109 | //
|
---|
| 110 | //
|
---|
| 111 | //
|
---|
| 112 | // add(new JLabel(" "), "center, wrap");
|
---|
| 113 | //
|
---|
| 114 | // JLabel n = new JLabel(m.getDemandPlan().toString());
|
---|
| 115 | // n.setFont(f2);
|
---|
| 116 | // add(n, "span 2 0, center, wrap");
|
---|
| 117 | //
|
---|
| 118 | //
|
---|
| 119 | // JPanel panel2 = new JPanel();
|
---|
| 120 | // //panel2.setFont(f1);
|
---|
| 121 | // panel2.setBackground(Color.WHITE);
|
---|
| 122 | // panel2.setBorder(BorderFactory.createTitledBorder("Demand Plan"));
|
---|
| 123 | // Canvas canvas3 = new DemandPlanDrawing(m.getDemandPlan());
|
---|
[226] | 124 | // canvas3.setBackground(Color.WHITE);
|
---|
[236] | 125 | // canvas3.setSize(800, 300);
|
---|
| 126 | // panel2.add(canvas3);
|
---|
| 127 | // add(panel2, "span 2 0, growx, growy, center, wrap");
|
---|
| 128 | //
|
---|
| 129 | //
|
---|
| 130 | //
|
---|
| 131 | //// Canvas canvas3 = new DemandPlanDrawing(m.getDemandPlan());
|
---|
| 132 | //// canvas3.setBackground(Color.WHITE);
|
---|
| 133 | //// canvas3.setSize(200, 400);
|
---|
| 134 | //// add(canvas3, "span 2 0, growx, growy, center, wrap");
|
---|
| 135 | //
|
---|
| 136 | //
|
---|
| 137 | //
|
---|
| 138 | //
|
---|
| 139 | //
|
---|
| 140 | // add(new JLabel(" "), "span 2 0, center, wrap");
|
---|
| 141 | //
|
---|
| 142 | // //a line
|
---|
| 143 | //// Canvas canvas4 = new Line(Color.BLACK,w);
|
---|
| 144 | //// canvas4.setSize(1, 1);
|
---|
| 145 | //// add(canvas4, "span 2 0, growx, center, wrap");
|
---|
| 146 | //
|
---|
| 147 | // add(new JLabel(" "), "span 2 0, center, wrap");
|
---|
| 148 | //
|
---|
| 149 | // //buttons
|
---|
| 150 | //
|
---|
| 151 | // add(new JButton("Edit..."), "cell 0 12, span 2 0, center, w 90"); // at dynamic position ? for the height ?! by canvases heights, or counting the rows and columns?
|
---|
| 152 | // add(new JButton("Delete..."), "cell 0 12, span 2 0, center, w 90");
|
---|
| 153 | // add(new JButton("Next..."), "cell 0 12, span 2 0, center, w 90");
|
---|
| 154 | // add(new JButton("Close"), "cell 0 12, span 2 0, center, wrap, w 90");
|
---|
| 155 | //
|
---|
| 156 | // //setting the background as the Bob's image
|
---|
| 157 | // getContentPane().setBackground(Color.decode("#AFD6D6"));
|
---|
| 158 | //
|
---|
| 159 | // setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
---|
| 160 | // pack();
|
---|
| 161 | //
|
---|
| 162 | // setLocationRelativeTo(null);
|
---|
| 163 | //// Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
---|
| 164 | //// setBounds(0,0,screenSize.width, screenSize.height);
|
---|
| 165 | //
|
---|
| 166 | // setVisible(true);
|
---|
| 167 | // }
|
---|
| 168 | //
|
---|
| 169 | // /**
|
---|
| 170 | // * @param args
|
---|
| 171 | // */
|
---|
| 172 | // public static void main(String[] args)
|
---|
| 173 | // {
|
---|
| 174 | // Main main = new Main();
|
---|
| 175 | // GUI gui = new GUI(main);
|
---|
| 176 | //
|
---|
| 177 | // }
|
---|
| 178 | //
|
---|
| 179 | //}
|
---|
| 180 | //
|
---|
| 181 | //
|
---|