From 50b3f80a19db06b9b7d662e83f662b2358e059a9 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 19 May 2008 15:34:21 +0000 Subject: Canvas seems to work finally. --- sources/simulator/VSSimulation.java | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'sources/simulator/VSSimulation.java') diff --git a/sources/simulator/VSSimulation.java b/sources/simulator/VSSimulation.java index c6ef5c1..1481c70 100644 --- a/sources/simulator/VSSimulation.java +++ b/sources/simulator/VSSimulation.java @@ -58,6 +58,7 @@ public class VSSimulation extends VSFrame implements ActionListener { setVisible(true); thread = new Thread(simulationPanel); + thread.start(); //logging.start(); logging.logg(prefs.getString("lang.simulation.new")); @@ -69,7 +70,6 @@ public class VSSimulation extends VSFrame implements ActionListener { localTextFields.add("0000"); globalTextFields.add("0000"); } - } private JMenuBar createJMenuBar() { @@ -193,7 +193,13 @@ public class VSSimulation extends VSFrame implements ActionListener { logging.setSimulationPanel(simulationPanel); simulationPanel.setBackground(prefs.getColor("paintarea.background")); - JScrollPane paintScrollPane = new JScrollPane(simulationPanel); + JPanel canvasPanel = new JPanel(); + canvasPanel.setLayout(new GridLayout(1, 1, 3, 3)); + canvasPanel.add(simulationPanel); + canvasPanel.setMinimumSize(new Dimension(0, 0)); + canvasPanel.setMaximumSize(new Dimension(0, 0)); + + //JScrollPane paintScrollPane = new JScrollPane(simulationPanel); JScrollPane textScrollPane = new JScrollPane(loggingArea); JPanel toolsPanel = createToolsPanel(); @@ -204,7 +210,7 @@ public class VSSimulation extends VSFrame implements ActionListener { splitPaneH.setOrientation(JSplitPane.HORIZONTAL_SPLIT); splitPaneH.setLeftComponent(createProcessPane()); - splitPaneH.setRightComponent(paintScrollPane); + splitPaneH.setRightComponent(canvasPanel); splitPaneH.setContinuousLayout(true); splitPaneH.setOneTouchExpandable(true); @@ -834,7 +840,7 @@ public class VSSimulation extends VSFrame implements ActionListener { pauseItem.setEnabled(true); resetItem.setEnabled(false); replayItem.setEnabled(true); - registeredProhread(); + simulationPanel.play(); } else if (source.getText().equals(prefs.getString("lang.pause"))) { startItem.setEnabled(true); @@ -856,18 +862,7 @@ public class VSSimulation extends VSFrame implements ActionListener { resetItem.setEnabled(false); replayItem.setEnabled(true); simulationPanel.reset(); - registeredProhread(); - } - } - - private void registeredProhread() { - if (hasStarted) { simulationPanel.play(); - - } else { - hasStarted = true; - thread = new Thread(simulationPanel); - thread.start(); } } -- cgit v1.2.3