From 713d9dbec8d946ccb39b5eee94eafc4e0fa13163 Mon Sep 17 00:00:00 2001 From: TRC9696 Date: Mon, 30 Jan 2023 18:08:24 +0100 Subject: [PATCH] refactoring: added method drawAndPlaceButtons --- src/main/java/game/StartTicTacToeGame.java | 26 ++++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/main/java/game/StartTicTacToeGame.java b/src/main/java/game/StartTicTacToeGame.java index 65db32c..04cd92e 100644 --- a/src/main/java/game/StartTicTacToeGame.java +++ b/src/main/java/game/StartTicTacToeGame.java @@ -46,6 +46,20 @@ public class StartTicTacToeGame implements ActionListener{ drawGameCanvas(); + drawAndPlaceButtons(); + + } + + 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 drawAndPlaceButtons() { fieldButton = new JButton(); fieldButton.setBackground(Color.white); fieldButton.setBounds(200, 100, 100,100); @@ -108,21 +122,9 @@ public class StartTicTacToeGame implements ActionListener{ backButton.setFont(new Font("arial", Font.PLAIN, 16)); backButton.setText("Zurück"); 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;