1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
panel = new JPanel();
GridBagLayout grid = new GridBagLayout();
GridBagConstraints c = new GridBagConstraints();
c.gridwidth = GridBagConstraints.REMAINDER; // ça donne un retour à la ligne
panel.setLayout(grid);
label = new JLabel("Crêpes salées");
panel.add(label);
((GridBagLayout)panel.getLayout()).setConstraints(label, c);
chek = new Checkbox("jambon-fromage");
panel.add(chek);
chek.addItemListener(this);
chek1 = new Checkbox("jambon-fromage-oeuf");
panel.add(chek1);
chek2 = new Checkbox("jambon-fromage-champignon");
panel.add(chek2);
((GridBagLayout)panel.getLayout()).setConstraints(label, c);
labell = new JLabel("Crêpes sucrées");
panel.add(labell);
((GridBagLayout)panel.getLayout()).setConstraints(labell, c);
chek = new Checkbox("sucre");
panel.add(chek);
chek.addItemListener(this);
chek1 = new Checkbox("chocolat");
panel.add(chek1);
chek2 = new Checkbox("chocolat-banane");
panel.add(chek2); |
Partager