From af48649d42cfeafd78441126b3f9c3055a9cfe8a Mon Sep 17 00:00:00 2001 From: fdai4581 Date: Mon, 6 Feb 2023 19:28:22 +0100 Subject: [PATCH 1/5] update --- src/main/java/BattleShip/BSButton.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/BattleShip/BSButton.java b/src/main/java/BattleShip/BSButton.java index 130af7e..7042215 100644 --- a/src/main/java/BattleShip/BSButton.java +++ b/src/main/java/BattleShip/BSButton.java @@ -1,5 +1,10 @@ package BattleShip; -public class BSButton { +import javax.swing.*; + +public class BSButton { + + int gridLocation; + Ship cellContents = null; } \ No newline at end of file From c7c667ff9c74ea41c3b4461a329c3161c4b02a52 Mon Sep 17 00:00:00 2001 From: fdai4581 Date: Mon, 6 Feb 2023 19:29:09 +0100 Subject: [PATCH 2/5] refactoring: --- src/main/java/BattleShip/BSButton.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/BattleShip/BSButton.java b/src/main/java/BattleShip/BSButton.java index 7042215..c9eb96e 100644 --- a/src/main/java/BattleShip/BSButton.java +++ b/src/main/java/BattleShip/BSButton.java @@ -2,7 +2,7 @@ package BattleShip; import javax.swing.*; -public class BSButton { +public class BSButton extends JButton { int gridLocation; Ship cellContents = null; From 5f3434c72ef6387a9fce4e44798ccce5a2619c50 Mon Sep 17 00:00:00 2001 From: fdai4581 Date: Mon, 6 Feb 2023 19:31:19 +0100 Subject: [PATCH 3/5] refactoring: --- src/main/java/BattleShip/Direction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/BattleShip/Direction.java b/src/main/java/BattleShip/Direction.java index 19cedde..29dcc6f 100644 --- a/src/main/java/BattleShip/Direction.java +++ b/src/main/java/BattleShip/Direction.java @@ -1,6 +1,6 @@ package BattleShip; -public class Direction { +class Direction { int countHits, cellLocation; From 7419bb5ec96e4d51e4181b5a83dd1b41564b5d38 Mon Sep 17 00:00:00 2001 From: fdai4581 Date: Mon, 6 Feb 2023 19:33:32 +0100 Subject: [PATCH 4/5] update --- src/main/java/BattleShip/BSButton.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/BattleShip/BSButton.java b/src/main/java/BattleShip/BSButton.java index c9eb96e..b6c2426 100644 --- a/src/main/java/BattleShip/BSButton.java +++ b/src/main/java/BattleShip/BSButton.java @@ -7,4 +7,12 @@ public class BSButton extends JButton { int gridLocation; Ship cellContents = null; + public void setGridLocation(int l) { + gridLocation = l; + } + + public int getGridLocation() { + return gridLocation; + } + } \ No newline at end of file From 73f023d78256129b20117c2125cd7ee6c32707a9 Mon Sep 17 00:00:00 2001 From: fdai4581 Date: Mon, 6 Feb 2023 19:35:22 +0100 Subject: [PATCH 5/5] update --- src/main/java/BattleShip/BSButton.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/BattleShip/BSButton.java b/src/main/java/BattleShip/BSButton.java index b6c2426..3262b23 100644 --- a/src/main/java/BattleShip/BSButton.java +++ b/src/main/java/BattleShip/BSButton.java @@ -15,4 +15,12 @@ public class BSButton extends JButton { return gridLocation; } + public void setCellContents(Ship s) { + cellContents = s; + } + + public Ship getCellContents() { + return cellContents; + } + } \ No newline at end of file