Example #1
0
File: Put.java Project: bsiever/JLS
  /**
   * 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
Example #2
0
File: Put.java Project: bsiever/JLS
  /**
   * 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
Example #3
0
File: Put.java Project: bsiever/JLS
  /**
   * Get put's y-coordinate.
   *
   * @return The y-coordinate.
   */
  public int getY() {

    return element.getY() + yr;
  } // end of getY method
Example #4
0
File: Put.java Project: bsiever/JLS
  /**
   * Get put's x-coordinate.
   *
   * @return The x-coordinate.
   */
  public int getX() {

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