예제 #1
0
 /**
  * Causes the module to move to the specified Vector location.
  *
  * <p>This method is NOT overloadable because very specific things need to happen when moved for
  * the module to work correctly.
  *
  * @param v The Vector to move to.
  */
 public final void locate(Vector v) {
   onLocate(v);
   bounds.position =
       new Vector(
           v); // The Vector is copied so that nothing has a reference to position through a
               // refererence
 }
예제 #2
0
 /**
  * Causes the module to move to the specified position.
  *
  * <p>This method is NOT overloadable because very specific things need to happen when moved for
  * the module to work correctly.
  *
  * @param x The new x position of the module.
  * @param y The new y position of the module.
  */
 public final void locate(int x, int y) {
   onLocate(
       new Vector(
           x,
           y)); // Call the onLocate() method in case a subclass wants to know when it is
                // re-located
   bounds.position = new Vector(x, y); // The position has changed, so update the bounds position
 }
예제 #3
0
 /**
  * Causes the module to resize as the specified Vector.
  *
  * <p>This method is NOT overloadable because very specific things need to happen when resized for
  * the module to work correctly.
  *
  * @param v The Vector to resize to.
  */
 public final void resize(Vector v) {
   v.x = v.x < 0 ? 0 : v.x;
   v.y = v.y < 0 ? 0 : v.y;
   onResize(v);
   bounds.size =
       new Vector(
           v); // The Vector is copied so that nothing has a reference to size through a
               // refererence
   // doRenderCalc();
   repaint();
   // repaint();
 }
예제 #4
0
 /**
  * Causes the module to resize to the specified width and height.
  *
  * <p>This method is NOT overloadable because very specific things need to happen when resized for
  * the module to work correctly.
  *
  * @param width The new width of the module.
  * @param height The new height of the module.
  */
 public final void resize(int width, int height) {
   width = width < 0 ? 0 : width; // The Module should not be resizable to less than zero
   height = height < 0 ? 0 : height;
   onResize(
       new Vector(
           width,
           height)); // Call the onResize() method in case a subclass cares when it is resized
   bounds.size = new Vector(width, height); // Update the size of the bounds
   // doRenderCalc(); //Re-do render calculations because this now has a different buffer size
   // repaint(); //Redraw in case it needs to be re-drawn
   repaint();
 }
예제 #5
0
 public final boolean intersects(Rectangle r) {
   return (bounds.intersects(r));
 }
예제 #6
0
 public final boolean intersects(Module m) {
   return (bounds.intersects(m.bounds));
 }
예제 #7
0
 public final int bottom() {
   return bounds.bottom();
 }
예제 #8
0
  /*
  right() and bottom() return the x and y values of the right of the Module and thhe bottom of the Module,
  respectively.

  These cannot be modified.
  */
  public final int right() {
    return bounds.right();
  }
예제 #9
0
 /**
  * Returns whether the Module contains the specified point.
  *
  * <p>The Container classes often need to know whether a point is within the bounds of a Module,
  * particularly whether the Module contains the mouse so that it is active.
  *
  * @param point The point to check against.
  * @return Whether the point is within the Module's bounds.
  */
 public final boolean containsPoint(Vector point) {
   return bounds.contains(point);
 }