From 20b8fdcd6943f04f7e1329252cd8b1fbe09cf61b Mon Sep 17 00:00:00 2001 From: Eike Baran Date: Thu, 16 Mar 2017 18:46:09 +0100 Subject: [PATCH] fixed high cpu-usage while dragging components with grid on --- src/main/java/lc/kra/jds/Simulation.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/java/lc/kra/jds/Simulation.java b/src/main/java/lc/kra/jds/Simulation.java index 5f7c1bc..00e57a7 100644 --- a/src/main/java/lc/kra/jds/Simulation.java +++ b/src/main/java/lc/kra/jds/Simulation.java @@ -163,6 +163,7 @@ public enum Layer { TOPMOST, BOTTOMMOST; } private double zoom; private boolean gridVisible; + private BufferedImage gridBuffer; protected List listeners; @@ -714,12 +715,17 @@ private Graphics2D prepareGraphics(Graphics defaultGraphics) { return graphics; } private void paintGrid(Graphics graphics, Dimension size) { - graphics.setColor(Color.LIGHT_GRAY); - for(int x=0;x components) { paintComponents(graphics, components, null); } private void paintComponents(Graphics graphics, Collection components, Collection ignore) {