Stopped creation of unneccessary Rectangle instances
[Mograsim.git] / net.mograsim.logic.ui / src / net / mograsim / logic / ui / model / components / GUIComponent.java
index c19b800..edc3d7b 100644 (file)
@@ -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