package negotiator.onetomany; import java.awt.Canvas; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.Image; import java.awt.Toolkit; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import negotiator.onetomany.etc.Bob; import negotiator.onetomany.etc.Drawing; import negotiator.onetomany.etc.Line; //import negotiator.onetomany.etc.Line; import net.miginfocom.swing.MigLayout; /** * @author Faria Nassiri-Mofakham * */ public class GUI extends JFrame { Main main; private static final long serialVersionUID = -5602032021645365870L; public GUI(Main m) //throws MalformedURLException, IOException { super("Bob gets ready for negotiation ..."); main = m; // Show the GUI setLayout(new MigLayout("", "", "")); // how to change to url address of Bob ? "./NegotiatorGUI/src/main/java/negotiator/onetomany/etc/Bob.png" Canvas canvas0 = new Bob("C:\\Users\\fnm\\eclipse-workspace\\NegotiatorGUI\\src\\main\\java\\negotiator\\onetomany\\etc\\Bob.png"); // Canvas canvas0 = new Bob("NegotiatorGUI.src.main.java.negotiator.onetomany.etc.Bob.png"); canvas0.setSize(400, 200); add(canvas0, "growx, center, wrap"); //cannot make it center add(new JLabel(" "), "center, wrap"); //defining a font Font f1 = new Font("TimesRoman",Font.BOLD,20); Font f2 = new Font("TimesRoman",Font.ITALIC,20); JLabel l1_1 = new JLabel("The `Agent' receives Bob's PORTFOLIO as follows:"); l1_1.setFont(f2); //l1_1.setForeground(Color.GRAY); add(l1_1, "center, wrap"); Canvas canvas1 = new Drawing(m.getPortfolio()); canvas1.setSize(200, 200); add(canvas1, "growx, center, wrap"); //a line Canvas canvas2 = new Line(Color.BLACK,800); canvas2.setSize(1, 1); add(canvas2, "growx, center, wrap"); JLabel l2 = new JLabel("It also receives Bob's DEMAND PLAN as follows:"); l2.setFont(f1); add(l2, "center, wrap"); // Canvas canvas2 = new Drawing(m.getDemandPlan()); // canvas2.setSize(200, 200); // add(canvas2, "center"); // Canvas canvas2 = new Drawing(m.getPortfolio()); // canvas2.setSize(200, 200); // add(canvas2, "growx, growy, center, wrap"); // // //a line // Canvas canvas4 = new Line(Color.BLACK,800); // canvas4.setSize(1, 1); // add(canvas4, "growx, center, wrap"); //buttons add(new JButton("Edit..."), "cell 0 10, center, w 90"); add(new JButton("Delete..."), "cell 0 10, center, w 90"); add(new JButton("Next..."), "cell 0 10,center, w 90"); add(new JButton("Close"), "cell 0 10, center, wrap, w 90"); //setting the background as the Bob's image getContentPane().setBackground(Color.decode("#AFD6D6")); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); setLocationRelativeTo(null); // Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); // setBounds(0,0,screenSize.width, screenSize.height); setVisible(true); } /** * @param args */ public static void main(String[] args) { Main main = new Main(); GUI gui = new GUI(main); } }