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
| public class Formation extends JFrame {
/**
* serialVersionUID
*/
private static final long serialVersionUID = 1L;
private Box boxDefinition;
private Box boxDefinitionLabel;
private Box boxDefinitionText;
private JButton boutonCreer;
private JLabel labelNomFormation;
private JLabel labelDureeTypeSeance;
private JTextField txtNomFormation;
private JTextField txtDureeTypeSeance;
private JPanel panPrincipal;
private JPanel panFormation;
public Formation(){
this.setTitle("Caractéristique de la formation");
this.setSize(500, 500);
this.setLocationRelativeTo(null);
this.setVisible(true);
boxDefinition = Box.createHorizontalBox();
// LABEL
boxDefinitionLabel = Box.createVerticalBox();
labelNomFormation = new JLabel("* Nom de la Formation :");
labelNomFormation.setFont(new Font(null, Font.PLAIN, 14));
boxDefinitionLabel.add(labelNomFormation);
labelDureeTypeSeance = new JLabel("* Durée type d'une séance :");
labelDureeTypeSeance.setFont(new Font(null, Font.PLAIN, 14));
boxDefinitionLabel.add(labelDureeTypeSeance);
boxDefinitionLabel.setPreferredSize(new Dimension(200, boxDefinitionLabel.getPreferredSize().height));
boxDefinition.add(boxDefinitionLabel);
// TEXT
boxDefinitionText = Box.createVerticalBox();
txtNomFormation = new JTextField();
txtDureeTypeSeance = new JTextField();
boxDefinitionText.add(txtNomFormation);
boxDefinitionText.add(txtDureeTypeSeance);
boxDefinitionText.setPreferredSize(new Dimension(100, boxDefinitionText.getPreferredSize().height));
boxDefinition.add(boxDefinitionText);
boutonCreer = new JButton("Créer la formation");
boutonCreer.setPreferredSize(new Dimension(30, 30));
panFormation = new JPanel(new BorderLayout());
panFormation.add(boxDefinition, BorderLayout.NORTH);
panFormation.add(boutonCreer, BorderLayout.CENTER);
panPrincipal = new JPanel(new BorderLayout());
panPrincipal.add(panFormation, BorderLayout.NORTH);
this.add(panPrincipal); |