Beispiel #1
0
  /**
   * See if this put is at the same place as another put.
   *
   * @param other The other put.
   * @return true if at the same place, false if not.
   */
  public boolean intersects(Put other) {

    int thisx = element.getX() + xr;
    int thisy = element.getY() + yr;
    int otherx = other.element.getX() + other.xr;
    int othery = other.element.getY() + other.yr;
    if (this != other && thisx == otherx && thisy == othery) {
      return true;
    }
    return false;
  } // end of intersects method
Beispiel #2
0
  /**
   * Draw this put.
   *
   * @param g The graphics object to draw with.
   */
  public void draw(Graphics g) {

    Color inside;
    if (touching) {
      inside = JLSInfo.touchColor;
    } else if (isAttached()) {
      inside = Color.BLACK;
      return;
    } else {
      inside = Color.WHITE;
    }
    int d = JLSInfo.pointDiameter;
    int r = d / 2;
    int x = element.getX() + xr;
    int y = element.getY() + yr;
    g.setColor(Color.BLACK);
    g.fillOval(x - r, y - r, d, d);
    g.setColor(inside);
    g.fillOval(x - r + 1, y - r + 1, d - 2, d - 2);
  } // end of draw method
Beispiel #3
0
  /**
   * Get put's x-coordinate.
   *
   * @return The x-coordinate.
   */
  public int getX() {

    return element.getX() + xr;
  } // end of getX method