39 lines
No EOL
638 B
Java
39 lines
No EOL
638 B
Java
package de.itsblue.ConnectFour;
|
|
|
|
import javax.swing.JPanel;
|
|
|
|
import java.awt.Color;
|
|
import java.awt.Dimension;
|
|
|
|
public class Plate extends JPanel {
|
|
|
|
/**
|
|
*
|
|
*/
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
enum PlateType {
|
|
X, O
|
|
}
|
|
|
|
private PlateType type;
|
|
|
|
Plate(PlateType type) {
|
|
this.setType(type);
|
|
|
|
this.setPreferredSize(new Dimension(20, 20));
|
|
|
|
this.setBackground(this.type == PlateType.X ? Color.RED:Color.BLACK);
|
|
|
|
}
|
|
|
|
|
|
public PlateType getType() {
|
|
return type;
|
|
}
|
|
|
|
private void setType(PlateType type) {
|
|
this.type = type;
|
|
}
|
|
|
|
} |