TextComponent no longer eats your CPU
[Mograsim.git] / net.mograsim.logic.model / src / net / mograsim / logic / model / model / components / atomic / TextComponent.java
index ec91151..4161406 100644 (file)
@@ -39,7 +39,8 @@ public class TextComponent extends GUIComponent
        public void render(GeneralGC gc, Rectangle visibleRegion)
        {
                Point textExtent = gc.textExtent(text);
-               setSize(textExtent.x, textExtent.y);
+               if (getWidth() != textExtent.x || getHeight() != textExtent.y)
+                       setSize(textExtent.x, textExtent.y);
 
                Color textColor = Preferences.current().getColor("net.mograsim.logic.model.color.text");
                if (textColor != null)