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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
| import java.awt.Color;
import java.awt.Font;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class IHM extends JFrame {
public IHM(){
this.setTitle("Fast food");
this.setSize(600, 600);
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// On instancie tous nos composants:
Panfond principal = new Panfond();
JPanel pan1 = new JPanel();
JPanel pan2 = new JPanel();
JPanel pan3 = new JPanel();
JPanel pan4 = new JPanel();
JPanel pan5 = new JPanel();
JCheckBox check1 = new JCheckBox("Frite");
JCheckBox check2 = new JCheckBox("Coca");
JCheckBox check3 = new JCheckBox("Glace");
JCheckBox check4 = new JCheckBox("Big Mac");
JCheckBox check5 = new JCheckBox("Cheese Burger");
JCheckBox check6 = new JCheckBox("Potatoes");
JCheckBox check7 = new JCheckBox("Salade poulet");
JCheckBox check8 = new JCheckBox("Eau");
JCheckBox check9 = new JCheckBox("Ketchup");
JCheckBox check10 = new JCheckBox("Moutarde");
JButton commander = new JButton("Commander et payer");
JButton reinit = new JButton("Réinitialiser la commande");
JLabel pres = new JLabel("Bienvenue sur Fast Food and Fat");
Font ecriture = new Font("Tahoma", Font.BOLD, 30);
this.setContentPane(principal);
pres.setFont(ecriture);
pres.setForeground(Color.ORANGE);
pan1.setLayout(new BoxLayout(pan1, BoxLayout.LINE_AXIS));
pan2.setLayout(new BoxLayout(pan2, BoxLayout.LINE_AXIS));
pan3.setLayout(new BoxLayout(pan3, BoxLayout.LINE_AXIS));
pan4.setLayout(new BoxLayout(pan4, BoxLayout.LINE_AXIS));
pan5.setLayout(new BoxLayout(pan5, BoxLayout.PAGE_AXIS));
pan1.add(pres);
pan2.add(check1);
pan2.add(check2);
pan2.add(check3);
pan2.add(check4);
pan2.add(check5);
pan3.add(check6);
pan3.add(check7);
pan3.add(check8);
pan3.add(check9);
pan3.add(check10);
pan4.add(commander);
pan4.add(reinit);
pan5.add(pan1);
pan5.add(pan2);
pan5.add(pan3);
pan5.add(pan4);
this.getContentPane().add(pan5);
this.setVisible(true);
}
} |
Partager