From: Daniel Kirschten Date: Wed, 29 May 2019 15:42:50 +0000 (+0200) Subject: GUIManualSwitch now renders at the correct location X-Git-Url: https://mograsim.net/gitweb/?a=commitdiff_plain;h=cd0a740c20afae7181c797e793666a34e51b1864;p=Mograsim.git GUIManualSwitch now renders at the correct location --- diff --git a/LogicUI/src/era/mi/gui/model/components/GUIManualSwitch.java b/LogicUI/src/era/mi/gui/model/components/GUIManualSwitch.java index b215cff8..c45224ab 100644 --- a/LogicUI/src/era/mi/gui/model/components/GUIManualSwitch.java +++ b/LogicUI/src/era/mi/gui/model/components/GUIManualSwitch.java @@ -31,13 +31,16 @@ public class GUIManualSwitch extends GUIComponent @Override public void render(GeneralGC gc, Rectangle visibleRegion) { - gc.drawRectangle(0, 0, width, height); + double posX = getBounds().x; + double posY = getBounds().y; + + gc.drawRectangle(posX, posY, width, height); String label = BitVectorFormatter.formatValueAsString(end); Font oldFont = gc.getFont(); Font labelFont = new Font(oldFont.getName(), fontHeight, oldFont.getStyle()); gc.setFont(labelFont); Point textExtent = gc.textExtent(label); - gc.drawText(label, (width - textExtent.x) / 2, (height - textExtent.y) / 2, true); + gc.drawText(label, posX + (width - textExtent.x) / 2, posY + (height - textExtent.y) / 2, true); gc.setFont(oldFont); }