From cd0a740c20afae7181c797e793666a34e51b1864 Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Wed, 29 May 2019 17:42:50 +0200 Subject: [PATCH] GUIManualSwitch now renders at the correct location --- .../src/era/mi/gui/model/components/GUIManualSwitch.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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); } -- 2.17.1