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); }