diff options
| author | Paul Buetow <paul@buetow.org> | 2008-05-19 15:47:36 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-05-19 15:47:36 +0000 |
| commit | 7b7f671ed874b82141f3be9d1d071e2e2eaf9cef (patch) | |
| tree | b671293d6dbcfd3a49e8d91206b85bb70d29d6e9 /sources/simulator/VSSimulationPanel.java | |
| parent | 50b3f80a19db06b9b7d662e83f662b2358e059a9 (diff) | |
buffer strategy is now synchronized.
Diffstat (limited to 'sources/simulator/VSSimulationPanel.java')
| -rw-r--r-- | sources/simulator/VSSimulationPanel.java | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/sources/simulator/VSSimulationPanel.java b/sources/simulator/VSSimulationPanel.java index 256e72e..8ee8f40 100644 --- a/sources/simulator/VSSimulationPanel.java +++ b/sources/simulator/VSSimulationPanel.java @@ -236,9 +236,11 @@ public class VSSimulationPanel extends Canvas implements Runnable, MouseMotionLi } if (strategy != null) { - //setPreferredSize(new Dimension(simulation.getWidth()-simulation.getSplitSize(),(int)paintSize-20)); - g = (Graphics2D) strategy.getDrawGraphics(); - g.setColor(Color.WHITE); + synchronized (strategy) { + //setPreferredSize(new Dimension(simulation.getWidth()-simulation.getSplitSize(),(int)paintSize-20)); + g = (Graphics2D) strategy.getDrawGraphics(); + g.setColor(Color.WHITE); + } } } @@ -297,23 +299,24 @@ public class VSSimulationPanel extends Canvas implements Runnable, MouseMotionLi } } - g.fillRect(0, 0, getWidth(), getHeight()); - - final long globalTime = time; + synchronized (strategy) { + g.fillRect(0, 0, getWidth(), getHeight()); + final long globalTime = time; - globalTimeXPosition = getTimeXPosition(globalTime); - paintSecondlines(g); - paintProcesses(g, globalTime); - paintGlobalTime(g, globalTime); + globalTimeXPosition = getTimeXPosition(globalTime); + paintSecondlines(g); + paintProcesses(g, globalTime); + paintGlobalTime(g, globalTime); - synchronized (messageLines) { - for (VSMessageLine line : messageLines) - line.draw(g, globalTime); - } + synchronized (messageLines) { + for (VSMessageLine line : messageLines) + line.draw(g, globalTime); + } - g.setColor(Color.WHITE); + g.setColor(Color.WHITE); - strategy.show(); + strategy.show(); + } } private void paintProcesses(Graphics2D g, long globalTime) { |
