private void createGUI() { parent = new CustomFrame(); parent.setTitle("Parent"); parent.setLocation(50, 50); dialog = new CustomDialog(parent); dialog.setTitle("Dialog"); dialog.setModalityType((Dialog.ModalityType) null); dialog.setLocation(250, 50); frame = new TestFrame(); frame.setTitle("Frame"); frame.setLocation(50, 250); window = new TestWindow(frame); window.setLocation(250, 250); parent.setVisible(true); }
private static void createAndShowGUI() { drawingSurface = new DrawingSurface(); // controlPanel = new ControlPanel(drawingSurface); // drawingSurface.controlPanel = controlPanel; controlPanel = new TestFrame(drawingSurface); drawingSurface.controlPanel = controlPanel; System.out.println("Created GUI on EDT? " + SwingUtilities.isEventDispatchThread()); JFrame f = new JFrame("Graphical Model"); // Set Location Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); f.setLocation(dim.width / 10, dim.height / 10); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setResizable(false); f.add(drawingSurface); f.pack(); f.setVisible(true); /* JFrame controlPanelFrame = new JFrame("Control Panel"); controlPanelFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); controlPanelFrame.add(new ControlPanel(drawingSurface)); controlPanelFrame.setLocation(f.getLocation().x+f.getWidth(), f.getLocation().y); controlPanelFrame.pack(); controlPanelFrame.setVisible(true);*/ controlPanel.setLocation(f.getLocation().x + f.getWidth(), f.getLocation().y); controlPanel.pack(); controlPanel.setVisible(true); }