Fin du TP Heritage
This commit is contained in:
@@ -4,36 +4,22 @@ import java.awt.*;
|
||||
public class Test {
|
||||
public static void main(String[] args) {
|
||||
JFrame fenetre = new JFrame();
|
||||
int a = Integer.parseInt(args[0]);
|
||||
|
||||
fenetre.setSize(500,500);
|
||||
fenetre.setLocation(100,100);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
GridLayout layout = new GridLayout(a,a);
|
||||
FlowLayout layout = new FlowLayout(FlowLayout.CENTER);
|
||||
fenetre.setLayout(layout);
|
||||
|
||||
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);
|
||||
}
|
||||
JButton[] tab = {new JButton("Oui"), new JButton("Non"), new JButton("NSPP")};
|
||||
|
||||
fenetre.add(new JLabel("Aimez-vous les pieds ?"));
|
||||
for (int i = 0; i < 3; i++) {
|
||||
fenetre.add(tab[i]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
fenetre.setVisible(true);
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user