diff --git a/src/main/dig/cmos/tristateOut.dig b/src/main/dig/cmos/tristateOut.dig
index 7c8103f2d..98fe6f500 100644
--- a/src/main/dig/cmos/tristateOut.dig
+++ b/src/main/dig/cmos/tristateOut.dig
@@ -45,12 +45,12 @@
VDD
-
+
Ground
-
+
NFET
@@ -156,12 +156,18 @@
+
+ VDD
+
+
+
+
+ Ground
+
+
+
-
-
-
-
@@ -182,10 +188,6 @@
-
-
-
-
@@ -219,8 +221,8 @@
-
-
+
+
@@ -238,14 +240,6 @@
-
-
-
-
-
-
-
-
@@ -264,7 +258,7 @@
-
+
diff --git a/src/main/java/de/neemann/digital/gui/components/CircuitComponent.java b/src/main/java/de/neemann/digital/gui/components/CircuitComponent.java
index bafb005e3..614876cb3 100644
--- a/src/main/java/de/neemann/digital/gui/components/CircuitComponent.java
+++ b/src/main/java/de/neemann/digital/gui/components/CircuitComponent.java
@@ -377,7 +377,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
}
/**
- * Adds alle the wires representing the given value to the highlighted list
+ * Adds all the wires representing the given value to the highlighted list
*
* @param values the value
*/
@@ -399,7 +399,7 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
}
/**
- * Addes the given element to insert to the circuit
+ * Adds the given element to insert to the circuit
*
* @param element the element to insert
*/
@@ -415,14 +415,18 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe
protected void paintComponent(Graphics g) {
super.paintComponent(g);
- if (hasChanged
- || buffer == null
+ boolean needsNewBuffer = buffer == null
|| getWidth() != buffer.getWidth()
- || getHeight() != buffer.getHeight()
+ || getHeight() != buffer.getHeight();
+
+ if (hasChanged
+ || needsNewBuffer
|| highLighted.size() != highlightedPaintedSize) {
// long time = System.currentTimeMillis();
- buffer = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().createCompatibleImage(getWidth(), getHeight());
+ if (needsNewBuffer)
+ buffer = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().createCompatibleImage(getWidth(), getHeight());
+
Graphics2D gr2 = buffer.createGraphics();
gr2.setColor(Color.WHITE);
gr2.fillRect(0, 0, getWidth(), getHeight());