Browse Source

Update Implementation Methode AIGridGUI

main
Thoumi Ngonga Brice 2 years ago
parent
commit
e3802df79b
  1. 18
      src/main/java/BattleShip/AIGridGUI.java

18
src/main/java/BattleShip/AIGridGUI.java

@ -64,7 +64,25 @@ public class AIGridGUI extends JPanel {
allShips.add(battleship);
allShips.add(aircraftCarrier);
//Add all directions to an ArrayList to allow for comparing and sorting directions.
directions.add(up);
directions.add(down);
directions.add(right);
directions.add(left);
//Make grid that consists of r rows and c columns of buttons.
GridLayout g = new GridLayout(rows,columns);
this.setLayout(g);
for(int i = 0; i < (rows * columns); i++) {
BSButton b = new BSButton();
b.setGridLocation(i);
buttons.add(b);
this.add(b);
}
defaultBorder = buttons.get(0).getBorder();
}
}
Loading…
Cancel
Save