From 147fd205143d340349ce376c4ad09b4fff893617 Mon Sep 17 00:00:00 2001 From: fdai7431 Date: Wed, 18 Jan 2023 11:00:13 +0100 Subject: [PATCH] [TikTakToeGame Class]: Sauuberbutton und resetbutton definiert --- .../JavaGamelauncher/TikTakToeGame.java | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/TikTakToeGame.java b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/TikTakToeGame.java index 24fe6e8..7f284a9 100644 --- a/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/TikTakToeGame.java +++ b/JavaGamelauncher/src/main/java/de/hs_fulda/gruppenprojekt/JavaGamelauncher/TikTakToeGame.java @@ -154,6 +154,115 @@ public class TikTakToeGame extends JFrame{ btnNewButton9.setBackground(new Color(255, 255, 204)); btnNewButton9.setBounds(244, 254, 80, 80); panelHauptFeld.add(btnNewButton9); + + btnNewButtonReset.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + spielerIstDran = 1; + TextFieldAusgabe1.setText("Der Spieler 1 ist dran."); + textFieldAusgabe2.setText("Spieler 1: 0 Punkte"); + textFieldAusgabe3.setText("Spieler 1: 0 Punkte"); + + btn1 = "0"; btn2 = "0"; btn3 = "0"; btn4 = "0"; btn5 = "0"; btn6 = "0"; btn7 = "0"; btn8 = "0"; btn9 = "0"; + + btnNewButton1.setForeground(new Color(255, 255, 204)); + btnNewButton1.setBackground(new Color(255, 255, 204)); + + btnNewButton2.setForeground(new Color(255, 255, 204)); + btnNewButton2.setBackground(new Color(255, 255, 204)); + + btnNewButton3.setForeground(new Color(255, 255, 204)); + btnNewButton3.setBackground(new Color(255, 255, 204)); + + btnNewButton4.setForeground(new Color(255, 255, 204)); + btnNewButton4.setBackground(new Color(255, 255, 204)); + + btnNewButton5.setForeground(new Color(255, 255, 204)); + btnNewButton5.setBackground(new Color(255, 255, 204)); + + btnNewButton6.setForeground(new Color(255, 255, 204)); + btnNewButton6.setBackground(new Color(255, 255, 204)); + + btnNewButton7.setForeground(new Color(255, 255, 204)); + btnNewButton7.setBackground(new Color(255, 255, 204)); + + btnNewButton8.setForeground(new Color(255, 255, 204)); + btnNewButton8.setBackground(new Color(255, 255, 204)); + + btnNewButton9.setForeground(new Color(255, 255, 204)); + btnNewButton9.setBackground(new Color(255, 255, 204)); + + btnNewButton1.setEnabled(true); + btnNewButton2.setEnabled(true); + btnNewButton3.setEnabled(true); + btnNewButton4.setEnabled(true); + btnNewButton5.setEnabled(true); + btnNewButton6.setEnabled(true); + btnNewButton7.setEnabled(true); + btnNewButton8.setEnabled(true); + btnNewButton9.setEnabled(true); + + + } + + }); + btnNewButtonReset.setBackground(new Color(64, 128, 128)); + btnNewButtonReset.setForeground(Color.BLACK); + btnNewButtonReset.setFont(new Font("Consolas", Font.PLAIN, 15)); + btnNewButtonReset.setBounds(10, 490, 150, 60); + contentPane.add(btnNewButtonReset); + + btnNewButtonClearField.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + spielerIstDran = 1; + TextFieldAusgabe1.setText("Der Spieler 1 ist dran."); + + btn1 = "0"; btn2 = "0"; btn3 = "0"; btn4 = "0"; btn5 = "0"; btn6 = "0"; btn7 = "0"; btn8 = "0"; btn9 = "0"; + + btnNewButton1.setForeground(new Color(255, 255, 204)); + btnNewButton1.setBackground(new Color(255, 255, 204)); + + btnNewButton2.setForeground(new Color(255, 255, 204)); + btnNewButton2.setBackground(new Color(255, 255, 204)); + + btnNewButton3.setForeground(new Color(255, 255, 204)); + btnNewButton3.setBackground(new Color(255, 255, 204)); + + btnNewButton4.setForeground(new Color(255, 255, 204)); + btnNewButton4.setBackground(new Color(255, 255, 204)); + + btnNewButton5.setForeground(new Color(255, 255, 204)); + btnNewButton5.setBackground(new Color(255, 255, 204)); + + btnNewButton6.setForeground(new Color(255, 255, 204)); + btnNewButton6.setBackground(new Color(255, 255, 204)); + + btnNewButton7.setForeground(new Color(255, 255, 204)); + btnNewButton7.setBackground(new Color(255, 255, 204)); + + btnNewButton8.setForeground(new Color(255, 255, 204)); + btnNewButton8.setBackground(new Color(255, 255, 204)); + + btnNewButton9.setForeground(new Color(255, 255, 204)); + btnNewButton9.setBackground(new Color(255, 255, 204)); + + btnNewButton1.setEnabled(true); + btnNewButton2.setEnabled(true); + btnNewButton3.setEnabled(true); + btnNewButton4.setEnabled(true); + btnNewButton5.setEnabled(true); + btnNewButton6.setEnabled(true); + btnNewButton7.setEnabled(true); + btnNewButton8.setEnabled(true); + btnNewButton9.setEnabled(true); + + } + }); + btnNewButtonClearField.setForeground(Color.BLACK); + btnNewButtonClearField.setFont(new Font("Consolas", Font.PLAIN, 15)); + btnNewButtonClearField.setBackground(new Color(64, 128, 128)); + btnNewButtonClearField.setBounds(260, 490, 150, 60); + contentPane.add(btnNewButtonClearField); }//end }