Ejemplo n.º 1
0
  public void changeColor() {

    // set initial color of top left quadrant

    if ((cxLoc < vLine.getStart().getX()) && (cyLoc < hLine.getStart().getY())) {

      ball.setColor(Color.cyan);
    }
    // set initial color of top right quadrant

    if ((cxLoc > vLine.getStart().getX()) && (cyLoc < hLine.getStart().getY())) {

      ball.setColor(Color.magenta);
    }
    // set initial color of bottom left quadrant

    if ((cxLoc < vLine.getStart().getX()) && (cyLoc > hLine.getStart().getY())) {

      ball.setColor(Color.yellow);
    }
    // set initial color of bottom right quadrant

    if ((cxLoc > vLine.getStart().getX()) && (cyLoc > hLine.getStart().getY())) {

      ball.setColor(Color.black);
    }
  }