X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=net.mograsim.logic.ui%2Fsrc%2Fnet%2Fmograsim%2Flogic%2Fui%2Fmodel%2Fcomponents%2FGUIComponent.java;h=edc3d7b715355fd6196302c96394124da40ccf74;hb=c223a9de7b0ef783bcb4f7612da350583ca29abd;hp=c19b80038d9db5cb58ec66eedd66a19af8028252;hpb=a19dde054ec5cab3c835840d569880ee8ee156dc;p=Mograsim.git diff --git a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIComponent.java b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIComponent.java index c19b8003..edc3d7b7 100644 --- a/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIComponent.java +++ b/net.mograsim.logic.ui/src/net/mograsim/logic/ui/model/components/GUIComponent.java @@ -69,6 +69,26 @@ public abstract class GUIComponent return new Rectangle(bounds.x, bounds.y, bounds.width, bounds.height); } + public double getPosX() + { + return bounds.x; + } + + public double getPosY() + { + return bounds.y; + } + + public double getWidth() + { + return bounds.width; + } + + public double getHeight() + { + return bounds.height; + } + /** * Called when this component is clicked. Absolute coordinates of the click are given. Returns true if this component consumed this * click. @@ -89,7 +109,10 @@ public abstract class GUIComponent public Pin getPin(String name) { - return pinsByName.get(name); + Pin pin = pinsByName.get(name); + if (pin == null) + throw new IllegalArgumentException("No pin with the name " + name); + return pin; } // @formatter:off