20 Mars
This commit is contained in:
20
DEV2.1/TP5:MiseEnPageEtDessin/Damier.java
Normal file
20
DEV2.1/TP5:MiseEnPageEtDessin/Damier.java
Normal file
@@ -0,0 +1,20 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user