From 422b6270834427dbd52b60d1894e7a012b44d1e6 Mon Sep 17 00:00:00 2001 From: Thoumi Ngonga Brice Date: Tue, 7 Feb 2023 01:58:56 +0100 Subject: [PATCH] Update Implementation AIGridGUI class --- src/main/java/BattleShip/AIGridGUI.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/BattleShip/AIGridGUI.java b/src/main/java/BattleShip/AIGridGUI.java index 067352c..0137f24 100644 --- a/src/main/java/BattleShip/AIGridGUI.java +++ b/src/main/java/BattleShip/AIGridGUI.java @@ -475,6 +475,17 @@ public class AIGridGUI extends JPanel { } highlightCells(cell, 0); } + + if(e.getButton() == MouseEvent.BUTTON3) { + //Toggle whether ship placement is vertical or horizontal. + vertical = !vertical; + for(BSButton bsb : buttons) { + if(bsb.getCellContents() == null) { + bsb.setBorder(defaultBorder); + } + } + highlightCells(cell, 0); + } } public void mouseExited(MouseEvent e) {