TP03
This commit is contained in:
Binary file not shown.
@@ -13,15 +13,23 @@ public class Test {
|
|||||||
GridLayout layout = new GridLayout(a,a);
|
GridLayout layout = new GridLayout(a,a);
|
||||||
fenetre.setLayout(layout);
|
fenetre.setLayout(layout);
|
||||||
|
|
||||||
for(int i = 0; i < a*a; i++) {
|
Color color_1 = Color.WHITE;
|
||||||
JPanel panneau = new JPanel();
|
Color color_2 = Color.CYAN;
|
||||||
if (i%2 == 0) {
|
|
||||||
panneau.setBackground(Color.WHITE);
|
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);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
panneau.setBackground(Color.CYAN);
|
|
||||||
}
|
|
||||||
fenetre.add(panneau);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user