예제 #1
0
 public void mouseEntered(MouseEvent e) {
   Color c = Tools.boost(BoardFrame.BOARD_COLOR, Globals.LABEL_VARIANT);
   this.label.setForeground(Tools.fade(c));
   // label.setToolTipText("Click to change board size.");
   label.setToolTipText(BoardFrame.messages.getString("boardSizeHover"));
   // boardSizeHover
 }
예제 #2
0
 /**
  * Finds a capture by following a path that starts at Point "o" location and ends at "o" as well.
  * Recursively checks every adjacent Point to find a valid path. Reverts when a dead end has been
  * reached. a valid capture must have at least 4 Point Objects.
  *
  * @param o Point where to start
  * @param squareSize integer length of the sides of a grid square
  * @return true when a valid capture was found, and false otherwise.
  * @throws InterruptedException
  */
 public boolean buildPath(Point o, double squareSize) {
   if (this.successful) {
     return true;
   }
   /* Get all adjacent Points */
   Point[] box = Tools.boxCoord(o, squareSize);
   /* Find the point in this box that belongs to the path */
   for (int i = 0; i < box.length; i++) {
     /* Stop recursive call here if a path was already found */
     if (this.successful) {
       return true;
     }
     if (Game.isPath(box[i])) { // if this Point is path
       if (box[i].compareTo(this.from) != 0) { // is it == to previous
         if (!Tools.containPoint(o, this.selected)) {
           /* Add o if it hasn't been visited */
           this.selected.add(o);
           this.from = o; /* Move to the next Point */
           if (box[i].compareTo(this.origin) == 0 && this.selected.size() > 3) {
             this.successful = true; /* Set recursive call stop */
             this.origin = null; /* Reset the origin */
             System.out.println("A cell was found: \n" + "box[" + i + "]\n");
             return true; /* Capture was found */
           }
           /* This adjacent Point was a dead end */
           if (!buildPath(box[i], squareSize)) {
             this.selected.remove(o);
             continue;
           }
         }
       }
     }
   }
   return false; /* No path */
 }
예제 #3
0
 public void mouseEntered(MouseEvent arg0) {
   Color color;
   color = Tools.fade(this.label.getForeground());
   this.label.setForeground(color);
 }
예제 #4
0
 public void mouseExited(MouseEvent arg0) {
   Color color;
   color = Tools.boost(this.label.getForeground());
   this.label.setForeground(color);
 }