fin
This commit is contained in:
@@ -6,17 +6,20 @@ public class Damier {
|
||||
public static void main(String[] args) {
|
||||
Color blanc = new Color(255,255,255);
|
||||
Color cyan = new Color(0,255,255);
|
||||
Color tab[] = {blanc,cyan};
|
||||
int l = Integer.parseInt(args[0]);
|
||||
System.out.println(l);
|
||||
JFrame fenetre = new JFrame();
|
||||
fenetre.setSize(500, 300);
|
||||
fenetre.setSize(500, 500);
|
||||
fenetre.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
GridLayout gestionnaire = new GridLayout(l, l);
|
||||
fenetre.setLayout(gestionnaire);
|
||||
JTextArea block = new JTextArea();
|
||||
for (int i=0; i<(l*l); i++){
|
||||
block.setBackground(tab[i%2]);
|
||||
fenetre.add(block);
|
||||
JTextField block = new JTextField(" ");
|
||||
if (i % 2 == 0)
|
||||
block.setBackground(blanc);
|
||||
else
|
||||
block.setBackground(cyan);
|
||||
fenetre.add(block);
|
||||
}
|
||||
fenetre.setVisible(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user