This commit is contained in:
2024-03-18 13:54:22 +01:00
parent eb581c8a31
commit a28bef01d7
69 changed files with 855 additions and 5 deletions

View File

@@ -6,17 +6,20 @@ public class Damier {
public static void main(String[] args) {
Color blanc = new Color(255,255,255);
Color cyan = new Color(0,255,255);
Color tab[] = {blanc,cyan};
int l = Integer.parseInt(args[0]);
System.out.println(l);
JFrame fenetre = new JFrame();
fenetre.setSize(500, 300);
fenetre.setSize(500, 500);
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
GridLayout gestionnaire = new GridLayout(l, l);
fenetre.setLayout(gestionnaire);
JTextArea block = new JTextArea();
for (int i=0; i<(l*l); i++){
block.setBackground(tab[i%2]);
fenetre.add(block);
JTextField block = new JTextField(" ");
if (i % 2 == 0)
block.setBackground(blanc);
else
block.setBackground(cyan);
fenetre.add(block);
}
fenetre.setVisible(true);
}