20 lines
535 B
Java
20 lines
535 B
Java
import javax.swing.*;
|
|
import java.awt.*;
|
|
|
|
public class Damier{
|
|
|
|
public static void main(String[] args) {
|
|
JFrame fenetre = new JFrame();
|
|
fenetre.setSize(400, 400);
|
|
fenetre.setLocation(0, 0);
|
|
GridLayout grille = new GridLayout(5,5);
|
|
fenetre.setLayout(grille);
|
|
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
|
|
for (int i=0; i < 25; ++i){
|
|
JPanel panel = new JPanel();
|
|
panel.setBackground(i%2 == 0 ? Color.WHITE : Color.CYAN);
|
|
fenetre.add(panel);
|
|
} fenetre.setVisible(true);
|
|
}
|
|
} |