diff --git a/src/main/java/BattleShip/AIGridGUI.java b/src/main/java/BattleShip/AIGridGUI.java index 9109210..f19e441 100644 --- a/src/main/java/BattleShip/AIGridGUI.java +++ b/src/main/java/BattleShip/AIGridGUI.java @@ -502,7 +502,7 @@ public class AIGridGUI extends JPanel { public void highlightCells(BSButton b, int x) { BSButton cell = b; - int action = x; + int actionToTake = x; clear = true; //Check whether sufficient spaces are clear to place the ship. @@ -521,11 +521,11 @@ public class AIGridGUI extends JPanel { for(int i = 0; i < shipToPlace.getLength(); i++) { BSButton bsb = buttons.get(cell.getGridLocation() + (i * columns)); //If mouse entered, highlight cells via lowered bevel. - if(action == 1) { + if(actionToTake == 0) { bsb.setBorder(loweredBevel); } else { //If mouse released, place ship and color ship cells. - if(action == 2) { + if(actionToTake == 1) { bsb.setCellContents(shipToPlace); bsb.setBackground(Color.blue); bsb.setBorder(loweredBevel); @@ -539,12 +539,12 @@ public class AIGridGUI extends JPanel { for(int i = 0; i < shipToPlace.getLength(); i++) { BSButton bsb = buttons.get(cell.getGridLocation() + i); - if(action == 0) { + if(actionToTake == 0) { //If mouse entered, highlight cells via lowered bevel. bsb.setBorder(loweredBevel); } else { //If mouse released, place ship and color ship cells. - if(action == 1) { + if(actionToTake == 1) { bsb.setCellContents(shipToPlace); bsb.setBackground(Color.blue); bsb.setBorder(loweredBevel);