diff --git a/DEV2.1/TP03/Test.class b/DEV2.1/TP03/Test.class index 8bbac2e..d479188 100644 Binary files a/DEV2.1/TP03/Test.class and b/DEV2.1/TP03/Test.class differ diff --git a/DEV2.1/TP03/Test.java b/DEV2.1/TP03/Test.java index 0cd9dbd..98de2ef 100644 --- a/DEV2.1/TP03/Test.java +++ b/DEV2.1/TP03/Test.java @@ -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); + } + }