From ceca0a72877993fa5271a3bb495de4d45818ae37 Mon Sep 17 00:00:00 2001 From: Thoumi Ngonga Brice Date: Tue, 7 Feb 2023 01:40:54 +0100 Subject: [PATCH] Update Implementation AIGridGUI class --- src/main/java/BattleShip/AIGridGUI.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/BattleShip/AIGridGUI.java b/src/main/java/BattleShip/AIGridGUI.java index 845abf4..03c5596 100644 --- a/src/main/java/BattleShip/AIGridGUI.java +++ b/src/main/java/BattleShip/AIGridGUI.java @@ -437,7 +437,9 @@ public class AIGridGUI extends JPanel { class SetShipsListener implements MouseListener { public void mouseEntered(MouseEvent e) { - + //Highlight cell when mouse entered. + BSButton cell = (BSButton) e.getSource(); + highlightCells(cell, 0); } public void mouseReleased(MouseEvent e) { @@ -450,4 +452,10 @@ public class AIGridGUI extends JPanel { public void mouseClicked(MouseEvent e) {} public void mousePressed(MouseEvent e) {} } + + public void highlightCells(BSButton b, int x) { + BSButton cell = b; + int actionToTake = x; + clear = true; + } }