From bbe19c44fe9cdc7cdb20c52a6797888182190557 Mon Sep 17 00:00:00 2001 From: TRC9696 Date: Mon, 30 Jan 2023 18:06:58 +0100 Subject: [PATCH] refactoring: added method drawGameCanvas --- src/main/java/game/StartTicTacToeGame.java | 25 +++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/main/java/game/StartTicTacToeGame.java b/src/main/java/game/StartTicTacToeGame.java index 1fec784..65db32c 100644 --- a/src/main/java/game/StartTicTacToeGame.java +++ b/src/main/java/game/StartTicTacToeGame.java @@ -44,13 +44,7 @@ public class StartTicTacToeGame implements ActionListener{ gui.Frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); gui.Frame.getContentPane().setBackground(Color.BLACK); - - TicTacToeLabel = new JLabel(); - TicTacToeLabel.setText("Tic-Tac-Toe"); - TicTacToeLabel.setForeground(Color.white); - TicTacToeLabel.setFont(new Font("arial", Font.PLAIN, 30)); - TicTacToeLabel.setBounds(320,20,500,50); - gui.Frame.add(TicTacToeLabel); + drawGameCanvas(); fieldButton = new JButton(); fieldButton.setBackground(Color.white); @@ -113,11 +107,22 @@ public class StartTicTacToeGame implements ActionListener{ backButton.setVisible(false); backButton.setFont(new Font("arial", Font.PLAIN, 16)); backButton.setText("Zurück"); - gui.Frame.add(backButton); - - + gui.Frame.add(backButton); + } + public void drawGameCanvas() { + TicTacToeLabel = new JLabel(); + TicTacToeLabel.setText("Tic-Tac-Toe"); + TicTacToeLabel.setForeground(Color.white); + TicTacToeLabel.setFont(new Font("arial", Font.PLAIN, 30)); + TicTacToeLabel.setBounds(320,20,500,50); + gui.Frame.add(TicTacToeLabel); + } + + + + public void player1Turn() { player1Turn = true; player2Turn = false;