fixed flicker if component tree view is enabled or disabled.

This commit is contained in:
hneemann 2017-03-31 16:35:15 +02:00
parent 228e990557
commit a0a74a7dab
2 changed files with 5 additions and 2 deletions

View File

@ -324,7 +324,7 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E
getContentPane().add(circuitComponent);
componentOnPane = circuitComponent;
}
pack();
revalidate();
});
toolBar.add(viewHelp.createJButtonNoText());

View File

@ -438,6 +438,9 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
|| getWidth() != buffer.getWidth()
|| getHeight() != buffer.getHeight();
if (needsNewBuffer && !isManualScale)
fitCircuit();
if (hasChanged
|| needsNewBuffer
|| highLighted.size() != highlightedPaintedSize) {
@ -455,7 +458,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
circuit.drawTo(gr, highLighted, modelSync);
highlightedPaintedSize = highLighted.size();
hasChanged = false;
// LOGGER.debug("repaint: " + Long.toString(System.currentTimeMillis() - time) + "ms");
// System.out.println("repaint: " + Long.toString(System.currentTimeMillis() - time) + "ms");
}
g.drawImage(buffer, 0, 0, null);