Exemplo n.º 1
0
Arquivo: Put.java Projeto: 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
Exemplo n.º 2
0
Arquivo: Put.java Projeto: 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
Exemplo n.º 3
0
Arquivo: Put.java Projeto: bsiever/JLS
  /**
   * Get put's y-coordinate.
   *
   * @return The y-coordinate.
   */
  public int getY() {

    return element.getY() + yr;
  } // end of getY method
Exemplo n.º 4
0
Arquivo: Put.java Projeto: bsiever/JLS
  /**
   * Get put's x-coordinate.
   *
   * @return The x-coordinate.
   */
  public int getX() {

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