P
Peter3000
Gast
Huhu, hab folgendes Problem, bekomme kein Raster hin was 2 x 2 ist. Obowhl es doch eigentlich klappen müsste.
Guckt mal bitte :
Guckt mal bitte :
Code:
import java.awt.*;
import javax.swing.*;
public class Spiel_brett extends JFrame{
Weisser_Panel wp1 = new Weisser_Panel();
Weisser_Panel wp2 = new Weisser_Panel();/
Schwarzer_Panel sp1 = new Schwarzer_Panel();
Schwarzer_Panel sp2 = new Schwarzer_Panel();
public Spiel_brett()
{
Container cp = getContentPane();
cp.setLayout(new GridLayout(4,4));
cp.add(wp1);
cp.add(sp1);
cp.add(wp2);
cp.add(sp2);
this.setSize(600,500);
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.setVisible(true);
}
}
class Weisser_Panel extends JPanel
{
public Weisser_Panel()
{
setBackground(Color.white);
}
}
class Schwarzer_Panel extends JPanel
{
public Schwarzer_Panel()
{
setBackground(Color.black);
}
}