Online-TicTacToe

Log | Files | Refs | README | LICENSE

commit 7931f5da205f67748c8cf176b052855e850132f1
parent cf9eea31fc3c2332715d35f0676ff773bb5b8698
Author: William Lindholm <william_lindholm@outlook.com>
Date:   Tue, 19 Nov 2024 16:56:27 +0000

Fixed a bug where back buttons did not work

Diffstat:
MTicTacToeClient/src/main/java/com/groupproject/tictactoeclient/ContentPanes/allscore.java | 18+++++++++---------
MTicTacToeClient/src/main/java/com/groupproject/tictactoeclient/ContentPanes/score.java | 18+++++++++---------
2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/TicTacToeClient/src/main/java/com/groupproject/tictactoeclient/ContentPanes/allscore.java b/TicTacToeClient/src/main/java/com/groupproject/tictactoeclient/ContentPanes/allscore.java @@ -37,6 +37,14 @@ public class allscore extends CustomPanel { // Set constraints for Back Button layout.putConstraint(SpringLayout.SOUTH, backButton, -10, SpringLayout.SOUTH, this); layout.putConstraint(SpringLayout.WEST, backButton, 10, SpringLayout.WEST, this); + + backButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + System.out.println("Hello, going back!"); + client.showPanel(new MainContentPanel(client)); + } + }); // Populate stats area try { @@ -103,18 +111,10 @@ public class allscore extends CustomPanel { statsArea.setText("An error occurred while calculating player stats."); e.printStackTrace(); } - - - backButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - client.showPanel(new MainContentPanel(client)); - } - }); } @Override public void refresh() { - throw new UnsupportedOperationException("Not supported yet."); + //throw new UnsupportedOperationException("Not supported yet."); } } diff --git a/TicTacToeClient/src/main/java/com/groupproject/tictactoeclient/ContentPanes/score.java b/TicTacToeClient/src/main/java/com/groupproject/tictactoeclient/ContentPanes/score.java @@ -30,6 +30,14 @@ public class score extends CustomPanel { layout.putConstraint(SpringLayout.SOUTH, backButton, -10, SpringLayout.SOUTH, this); layout.putConstraint(SpringLayout.WEST, backButton, 10, SpringLayout.WEST, this); + + // Back Button Action + backButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + client.showPanel(new MainContentPanel(client)); + } + }); try { @@ -90,18 +98,10 @@ public class score extends CustomPanel { statsLabel.setText("An error occurred while calculating player stats."); e.printStackTrace(); } - - // Back Button Action - backButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - client.showPanel(new MainContentPanel(client)); - } - }); } @Override public void refresh() { - throw new UnsupportedOperationException("Not supported yet."); // Generated method stub + //throw new UnsupportedOperationException("Not supported yet."); // Generated method stub } }