diff --git a/src/main/java/BattleShip/AIGridGUI.java b/src/main/java/BattleShip/AIGridGUI.java index ce216fa..9109210 100644 --- a/src/main/java/BattleShip/AIGridGUI.java +++ b/src/main/java/BattleShip/AIGridGUI.java @@ -26,7 +26,7 @@ public class AIGridGUI extends JPanel { int firstHit; Color darkRed = new Color(100, 0, 0); // Border loweredBevel = BorderFactory.createLoweredBevelBorder(); - Border raisedbevel = BorderFactory.createRaisedBevelBorder(); + //Border raisedbevel = BorderFactory.createRaisedBevelBorder(); Border defaultBorder; //empty = BorderFactory.createEmptyBorder(4, 4, 4, 4); Border compound = BorderFactory.createCompoundBorder(); @@ -535,6 +535,25 @@ public class AIGridGUI extends JPanel { } } } + }else { + + for(int i = 0; i < shipToPlace.getLength(); i++) { + BSButton bsb = buttons.get(cell.getGridLocation() + i); + if(action == 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) { + bsb.setCellContents(shipToPlace); + bsb.setBackground(Color.blue); + bsb.setBorder(loweredBevel); + } else { + //If mouse exited, unhighlight cells. + bsb.setBorder(defaultBorder); + } + } + } } } }