|
|
@ -736,6 +736,318 @@ public class TikTakToeGame extends JFrame{ |
|
|
|
}//end else |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
btnNewButton9.addActionListener(new ActionListener() { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
if(spielerIstDran == 1) { |
|
|
|
btnNewButton9.setForeground(new Color(255, 0, 0)); |
|
|
|
btnNewButton9.setBackground(new Color(255, 0, 0)); |
|
|
|
btn9 = "red"; |
|
|
|
|
|
|
|
btnNewButton9.setEnabled(false); |
|
|
|
if(btn9.equals("red") && btn7.equals("red") && btn8.equals("red") || |
|
|
|
btn9.equals("red") && btn6.equals("red") && btn3.equals("red") || |
|
|
|
btn1.equals("red") && btn5.equals("red") && btn9.equals("red")) { |
|
|
|
TextFieldAusgabe1.setText("Spieler 1 Hat gewonnen."); |
|
|
|
punkte1 +=1; |
|
|
|
|
|
|
|
btnNewButton1.setEnabled(false); |
|
|
|
btnNewButton2.setEnabled(false); |
|
|
|
btnNewButton3.setEnabled(false); |
|
|
|
btnNewButton4.setEnabled(false); |
|
|
|
btnNewButton5.setEnabled(false); |
|
|
|
btnNewButton6.setEnabled(false); |
|
|
|
btnNewButton7.setEnabled(false); |
|
|
|
btnNewButton8.setEnabled(false); |
|
|
|
}//end if |
|
|
|
else { |
|
|
|
TextFieldAusgabe1.setText("Der Spieler 2 ist dran."); |
|
|
|
spielerIstDran = 2; |
|
|
|
}//end else |
|
|
|
}//end if |
|
|
|
else if(spielerIstDran == 2){ |
|
|
|
btnNewButton9.setForeground(new Color(0, 0, 255)); |
|
|
|
btnNewButton9.setBackground(new Color(0, 0, 255)); |
|
|
|
btn9 = "blue"; |
|
|
|
|
|
|
|
btnNewButton9.setEnabled(false); |
|
|
|
if(btn9.equals("blue") && btn7.equals("blue") && btn8.equals("blue") || |
|
|
|
btn9.equals("blue") && btn6.equals("blue") && btn3.equals("blue") || |
|
|
|
btn1.equals("blue") && btn5.equals("blue") && btn9.equals("blue")) { |
|
|
|
TextFieldAusgabe1.setText("Spieler 2 Hat gewonnen."); |
|
|
|
punkte2 +=1; |
|
|
|
|
|
|
|
btnNewButton1.setEnabled(false); |
|
|
|
btnNewButton2.setEnabled(false); |
|
|
|
btnNewButton3.setEnabled(false); |
|
|
|
btnNewButton4.setEnabled(false); |
|
|
|
btnNewButton5.setEnabled(false); |
|
|
|
btnNewButton6.setEnabled(false); |
|
|
|
btnNewButton7.setEnabled(false); |
|
|
|
btnNewButton8.setEnabled(false); |
|
|
|
}//end if |
|
|
|
else { |
|
|
|
TextFieldAusgabe1.setText("Der Spieler 1 ist dran."); |
|
|
|
spielerIstDran = 1; |
|
|
|
}//end else |
|
|
|
}//end else if |
|
|
|
else { |
|
|
|
TextFieldAusgabe1.setText("Huiuiuiui, ein Fehler!."); |
|
|
|
}//end else |
|
|
|
} |
|
|
|
}); |
|
|
|
}//end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public JPanel getContentPane() { |
|
|
|
return contentPane; |
|
|
|
} |
|
|
|
/* |
|
|
|
public void setContentPane(JPanel contentPane) { |
|
|
|
this.contentPane = contentPane; |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
public boolean isGewonnen() { |
|
|
|
return gewonnen; |
|
|
|
} |
|
|
|
|
|
|
|
public void setGewonnen(boolean gewonnen) { |
|
|
|
this.gewonnen = gewonnen; |
|
|
|
} |
|
|
|
|
|
|
|
public JTextField getTextFieldAusgabe1() { |
|
|
|
return TextFieldAusgabe1; |
|
|
|
} |
|
|
|
|
|
|
|
public void setTextFieldAusgabe1(JTextField textFieldAusgabe1) { |
|
|
|
TextFieldAusgabe1 = textFieldAusgabe1; |
|
|
|
} |
|
|
|
|
|
|
|
public JTextField getTextFieldAusgabe2() { |
|
|
|
return textFieldAusgabe2; |
|
|
|
} |
|
|
|
|
|
|
|
public void setTextFieldAusgabe2(JTextField textFieldAusgabe2) { |
|
|
|
this.textFieldAusgabe2 = textFieldAusgabe2; |
|
|
|
} |
|
|
|
|
|
|
|
public JTextField getTextFieldAusgabe3() { |
|
|
|
return textFieldAusgabe3; |
|
|
|
} |
|
|
|
|
|
|
|
public void setTextFieldAusgabe3(JTextField textFieldAusgabe3) { |
|
|
|
this.textFieldAusgabe3 = textFieldAusgabe3; |
|
|
|
} |
|
|
|
|
|
|
|
public int getSpielerIstDran() { |
|
|
|
return spielerIstDran; |
|
|
|
} |
|
|
|
|
|
|
|
public void setSpielerIstDran(int spielerIstDran) { |
|
|
|
this.spielerIstDran = spielerIstDran; |
|
|
|
} |
|
|
|
|
|
|
|
public String getBtn1() { |
|
|
|
return btn1; |
|
|
|
} |
|
|
|
|
|
|
|
public void setBtn1(String btn1) { |
|
|
|
this.btn1 = btn1; |
|
|
|
} |
|
|
|
|
|
|
|
public String getBtn2() { |
|
|
|
return btn2; |
|
|
|
} |
|
|
|
|
|
|
|
public void setBtn2(String btn2) { |
|
|
|
this.btn2 = btn2; |
|
|
|
} |
|
|
|
|
|
|
|
public String getBtn3() { |
|
|
|
return btn3; |
|
|
|
} |
|
|
|
|
|
|
|
public void setBtn3(String btn3) { |
|
|
|
this.btn3 = btn3; |
|
|
|
} |
|
|
|
|
|
|
|
public String getBtn4() { |
|
|
|
return btn4; |
|
|
|
} |
|
|
|
|
|
|
|
public void setBtn4(String btn4) { |
|
|
|
this.btn4 = btn4; |
|
|
|
} |
|
|
|
|
|
|
|
public String getBtn5() { |
|
|
|
return btn5; |
|
|
|
} |
|
|
|
|
|
|
|
public void setBtn5(String btn5) { |
|
|
|
this.btn5 = btn5; |
|
|
|
} |
|
|
|
|
|
|
|
public String getBtn6() { |
|
|
|
return btn6; |
|
|
|
} |
|
|
|
|
|
|
|
public void setBtn6(String btn6) { |
|
|
|
this.btn6 = btn6; |
|
|
|
} |
|
|
|
|
|
|
|
public String getBtn7() { |
|
|
|
return btn7; |
|
|
|
} |
|
|
|
|
|
|
|
public void setBtn7(String btn7) { |
|
|
|
this.btn7 = btn7; |
|
|
|
} |
|
|
|
|
|
|
|
public String getBtn8() { |
|
|
|
return btn8; |
|
|
|
} |
|
|
|
|
|
|
|
public void setBtn8(String btn8) { |
|
|
|
this.btn8 = btn8; |
|
|
|
} |
|
|
|
|
|
|
|
public String getBtn9() { |
|
|
|
return btn9; |
|
|
|
} |
|
|
|
|
|
|
|
public void setBtn9(String btn9) { |
|
|
|
this.btn9 = btn9; |
|
|
|
} |
|
|
|
|
|
|
|
public String getSpieler1() { |
|
|
|
return spieler1; |
|
|
|
} |
|
|
|
|
|
|
|
public void setSpieler1(String spieler1) { |
|
|
|
this.spieler1 = spieler1; |
|
|
|
} |
|
|
|
|
|
|
|
public String getSpieler2() { |
|
|
|
return spieler2; |
|
|
|
} |
|
|
|
|
|
|
|
public void setSpieler2(String spieler2) { |
|
|
|
this.spieler2 = spieler2; |
|
|
|
} |
|
|
|
|
|
|
|
public int getPunkte1() { |
|
|
|
return punkte1; |
|
|
|
} |
|
|
|
|
|
|
|
public void setPunkte1(int punkte1) { |
|
|
|
this.punkte1 = punkte1; |
|
|
|
} |
|
|
|
|
|
|
|
public int getPunkte2() { |
|
|
|
return punkte2; |
|
|
|
} |
|
|
|
|
|
|
|
public void setPunkte2(int punkte2) { |
|
|
|
this.punkte2 = punkte2; |
|
|
|
} |
|
|
|
|
|
|
|
public JPanel getPanelHauptFeld() { |
|
|
|
return panelHauptFeld; |
|
|
|
} |
|
|
|
|
|
|
|
public void setPanelHauptFeld(JPanel panelHauptFeld) { |
|
|
|
this.panelHauptFeld = panelHauptFeld; |
|
|
|
} |
|
|
|
|
|
|
|
public JButton getBtnNewButton1() { |
|
|
|
return btnNewButton1; |
|
|
|
} |
|
|
|
|
|
|
|
public void setBtnNewButton1(JButton btnNewButton1) { |
|
|
|
this.btnNewButton1 = btnNewButton1; |
|
|
|
} |
|
|
|
|
|
|
|
public JButton getBtnNewButton2() { |
|
|
|
return btnNewButton2; |
|
|
|
} |
|
|
|
|
|
|
|
public void setBtnNewButton2(JButton btnNewButton2) { |
|
|
|
this.btnNewButton2 = btnNewButton2; |
|
|
|
} |
|
|
|
|
|
|
|
public JButton getBtnNewButton3() { |
|
|
|
return btnNewButton3; |
|
|
|
} |
|
|
|
|
|
|
|
public void setBtnNewButton3(JButton btnNewButton3) { |
|
|
|
this.btnNewButton3 = btnNewButton3; |
|
|
|
} |
|
|
|
|
|
|
|
public JButton getBtnNewButton4() { |
|
|
|
return btnNewButton4; |
|
|
|
} |
|
|
|
|
|
|
|
public void setBtnNewButton4(JButton btnNewButton4) { |
|
|
|
this.btnNewButton4 = btnNewButton4; |
|
|
|
} |
|
|
|
|
|
|
|
public JButton getBtnNewButton5() { |
|
|
|
return btnNewButton5; |
|
|
|
} |
|
|
|
|
|
|
|
public void setBtnNewButton5(JButton btnNewButton5) { |
|
|
|
this.btnNewButton5 = btnNewButton5; |
|
|
|
} |
|
|
|
|
|
|
|
public JButton getBtnNewButton6() { |
|
|
|
return btnNewButton6; |
|
|
|
} |
|
|
|
|
|
|
|
public void setBtnNewButton6(JButton btnNewButton6) { |
|
|
|
this.btnNewButton6 = btnNewButton6; |
|
|
|
} |
|
|
|
|
|
|
|
public JButton getBtnNewButton7() { |
|
|
|
return btnNewButton7; |
|
|
|
} |
|
|
|
|
|
|
|
public void setBtnNewButton7(JButton btnNewButton7) { |
|
|
|
this.btnNewButton7 = btnNewButton7; |
|
|
|
} |
|
|
|
|
|
|
|
public JButton getBtnNewButton8() { |
|
|
|
return btnNewButton8; |
|
|
|
} |
|
|
|
|
|
|
|
public void setBtnNewButton8(JButton btnNewButton8) { |
|
|
|
this.btnNewButton8 = btnNewButton8; |
|
|
|
} |
|
|
|
|
|
|
|
public JButton getBtnNewButton9() { |
|
|
|
return btnNewButton9; |
|
|
|
} |
|
|
|
|
|
|
|
public void setBtnNewButton9(JButton btnNewButton9) { |
|
|
|
this.btnNewButton9 = btnNewButton9; |
|
|
|
} |
|
|
|
|
|
|
|
public JButton getBtnNewButtonReset() { |
|
|
|
return btnNewButtonReset; |
|
|
|
} |
|
|
|
|
|
|
|
public void setBtnNewButtonReset(JButton btnNewButtonReset) { |
|
|
|
this.btnNewButtonReset = btnNewButtonReset; |
|
|
|
} |
|
|
|
|
|
|
|
public JButton getBtnNewButtonClearField() { |
|
|
|
return btnNewButtonClearField; |
|
|
|
} |
|
|
|
|
|
|
|
public void setBtnNewButtonClearField(JButton btnNewButtonClearField) { |
|
|
|
this.btnNewButtonClearField = btnNewButtonClearField; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |