This commit is contained in:
Simoes Lukas
2025-01-31 10:40:49 +01:00
parent 2217e7986c
commit 209f320a5a
2 changed files with 18 additions and 10 deletions

Binary file not shown.

View File

@@ -13,16 +13,24 @@ public class Test {
GridLayout layout = new GridLayout(a,a);
fenetre.setLayout(layout);
for(int i = 0; i < a*a; i++) {
JPanel panneau = new JPanel();
if (i%2 == 0) {
panneau.setBackground(Color.WHITE);
}
else {
panneau.setBackground(Color.CYAN);
}
fenetre.add(panneau);
}
Color color_1 = Color.WHITE;
Color color_2 = Color.CYAN;
for (int j = 0; j < a; j++) {
Color temp = color_1;
color_1 = color_2;
color_2 = temp;
for(int i = 0; i < a; i++) {
JPanel panneau = new JPanel();
if (i%2 == 0) {
panneau.setBackground(color_1);
}
else {
panneau.setBackground(color_2);
}
fenetre.add(panneau);
}
}