TP03
This commit is contained in:
Binary file not shown.
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user