Browse Source

refactoring: added method drawAndPlaceButtons

master
TRC9696 2 years ago
parent
commit
713d9dbec8
  1. 26
      src/main/java/game/StartTicTacToeGame.java

26
src/main/java/game/StartTicTacToeGame.java

@ -46,6 +46,20 @@ public class StartTicTacToeGame implements ActionListener{
drawGameCanvas(); 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 = new JButton();
fieldButton.setBackground(Color.white); fieldButton.setBackground(Color.white);
fieldButton.setBounds(200, 100, 100,100); fieldButton.setBounds(200, 100, 100,100);
@ -108,21 +122,9 @@ public class StartTicTacToeGame implements ActionListener{
backButton.setFont(new Font("arial", Font.PLAIN, 16)); backButton.setFont(new Font("arial", Font.PLAIN, 16));
backButton.setText("Zurück"); 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() { public void player1Turn() {
player1Turn = true; player1Turn = true;
player2Turn = false; player2Turn = false;

Loading…
Cancel
Save