|
@ -1,12 +1,13 @@ |
|
|
package de.tims.tictactoe; |
|
|
package de.tims.tictactoe; |
|
|
|
|
|
|
|
|
import java.awt.GridLayout; |
|
|
import java.awt.GridLayout; |
|
|
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
|
|
import java.awt.event.ActionListener; |
|
|
|
|
|
|
|
|
import javax.swing.BoxLayout; |
|
|
|
|
|
import javax.swing.JButton; |
|
|
import javax.swing.JButton; |
|
|
import javax.swing.JPanel; |
|
|
import javax.swing.JPanel; |
|
|
|
|
|
|
|
|
public class GameLogic { |
|
|
|
|
|
|
|
|
public class GameLogic implements ActionListener { |
|
|
|
|
|
|
|
|
private static final char PLAYER_1 = 'x'; |
|
|
private static final char PLAYER_1 = 'x'; |
|
|
private static final char PLAYER_2 = 'o'; |
|
|
private static final char PLAYER_2 = 'o'; |
|
@ -110,9 +111,20 @@ public class GameLogic { |
|
|
|
|
|
|
|
|
for (int i = 0; i < this.fields.length; i++) { |
|
|
for (int i = 0; i < this.fields.length; i++) { |
|
|
this.fields[i] = new JButton(); |
|
|
this.fields[i] = new JButton(); |
|
|
|
|
|
this.fields[i].addActionListener(this); |
|
|
this.contentPanel.add(this.fields[i]); |
|
|
this.contentPanel.add(this.fields[i]); |
|
|
} |
|
|
} |
|
|
return this.contentPanel; |
|
|
return this.contentPanel; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public JButton getGUIField(int number) { |
|
|
|
|
|
// TODO Auto-generated method stub |
|
|
|
|
|
return this.fields[number]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
|
// TODO Auto-generated method stub |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |