Actualiser src/fr/iutfbleau/papillon/FenetreAjout.java

This commit is contained in:
2025-10-21 18:04:09 +02:00
parent 07525b46dc
commit aee2b5888a
+33 -5
View File
@@ -8,6 +8,8 @@ public class FenetreAjout extends JFrame implements ActionListener {
private final JTextField champTitre; private final JTextField champTitre;
private final JTextArea champContenu; private final JTextArea champContenu;
private final JTextField rang;
private final JTextField theme;
private final JButton boutonValider; private final JButton boutonValider;
private final JButton boutonAnnuler; private final JButton boutonAnnuler;
private final Main parent; private final Main parent;
@@ -19,7 +21,7 @@ public class FenetreAjout extends JFrame implements ActionListener {
setSize(350, 250); setSize(350, 250);
setResizable(false); setResizable(false);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Layout principal // Layout principal
setLayout(new BorderLayout(10, 10)); setLayout(new BorderLayout(10, 10));
@@ -33,11 +35,11 @@ public class FenetreAjout extends JFrame implements ActionListener {
JLabel lblTitre = new JLabel("Titre :"); JLabel lblTitre = new JLabel("Titre :");
champTitre = new JTextField(20); champTitre = new JTextField(20);
c.gridx = 0; c.gridx = 0;
c.gridy = 0; c.gridy = 1;
c.weightx = 0; c.weightx = 0;
centre.add(lblTitre, c); centre.add(lblTitre, c);
c.gridx = 1; c.gridx = 1;
c.gridy = 0; c.gridy = 1;
c.weightx = 1; c.weightx = 1;
centre.add(champTitre, c); centre.add(champTitre, c);
@@ -49,15 +51,41 @@ public class FenetreAjout extends JFrame implements ActionListener {
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
c.gridx = 0; c.gridx = 0;
c.gridy = 1; c.gridy = 2;
c.weightx = 0; c.weightx = 0;
c.fill = GridBagConstraints.BOTH; c.fill = GridBagConstraints.BOTH;
centre.add(lblContenu, c); centre.add(lblContenu, c);
c.gridx = 1; c.gridx = 1;
c.gridy = 1; c.gridy = 2;
c.weightx = 1; c.weightx = 1;
c.weighty = 1.0; // prend la hauteur dispo
centre.add(scroll, c); centre.add(scroll, c);
// Rang
JLabel lblrang = new JLabel("Rang :");
rang = new JTextField(20);
c.gridx = 0;
c.gridy = 3;
c.weightx = 0;
c.weighty = 0.0; // prend la hauteur dispo
centre.add(lblrang, c);
c.gridx = 1;
c.gridy = 3;
c.weightx = 1;
centre.add(rang, c);
// theme
JLabel lbltheme = new JLabel("Theme :");
theme = new JTextField(20);
c.gridx = 0;
c.gridy = 4;
c.weightx = 0;
centre.add(lbltheme, c);
c.gridx = 1;
c.gridy = 4;
c.weightx = 1;
centre.add(theme, c);
// Bas : boutons // Bas : boutons
JPanel bas = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 10)); JPanel bas = new JPanel(new FlowLayout(FlowLayout.RIGHT, 10, 10));
boutonValider = new JButton("Valider"); boutonValider = new JButton("Valider");