Bonjour à tous !

Je souhaite créer un formulaire qui me permette de récupérer la valeur de chaque JtextField

voici mon code il est fonctionnel à quelques petits détails pret
je souhaiterais aligner le bouton valider au centre et choisir la couleur des cellules
pourriez vous svp m'expliquer comment y parvenir ? ( Peut être en utilisant plusieurs Layout différents ?)
le but final étant de créer un fichier image et un fichier HTML qui recupère l'ensemble des réponses
de ce formulaire.

Merci d'avance pour vos conseils !


Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
 
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
 
public class Fenetre extends JFrame implements ActionListener {
    private JPanel Pan=new JPanel();
    private JLabel JLB=new JLabel(" NOM");
    private JTextArea JTA=new JTextArea(" Préciser votre nom");  
    private JLabel JLB1=new JLabel(" PRENOM");
    private JTextArea JTA1=new JTextArea(" Préciser votre prénom");
    private JLabel JLB2=new JLabel(" PÔLE");
    private JTextArea JTA2=new JTextArea(" Préciser votre Pôle");
    private JLabel JLB3=new JLabel(" TEL FIXE");
    private JTextArea JTA3=new JTextArea(" Préciser votre N° de Tél Fixe");
    private JLabel JLB4=new JLabel(" TEL PORTABLE");
    private JTextArea JTA4=new JTextArea(" Préciser votre N° de Tél Portable");
    private JLabel JLB5=new JLabel(" FAX");
    private JTextArea JTA5=new JTextArea(" Préciser votre N° de Fax");
    private JLabel JLB6=new JLabel(" EMAIL");
    private JTextArea JTA6=new JTextArea(" Préciser votre adresse Email");
    private JCheckBox JCB=new JCheckBox("Afficher Adresse");
    private JCheckBox JCB1=new JCheckBox("Afficher Bandeau");
    private JButton JB=new JButton("Valider");
    private final GridLayout G;
 
    public Fenetre(){
 
    this.setTitle("Logiciel Signature Outlook");
    this.setSize(500,500);
    //this.setBackground(Color.yellow);
    this.setLocationRelativeTo(null);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);             
    this.setVisible(true);
    this.setContentPane(Pan);               
    this.setVisible(true);
    Pan.setLayout(G=new GridLayout(10,2));
    G.setHgap(10); //Cinq pixels d'espace entre les colonnes (H comme Horizontal)
    G.setVgap(10);
    JLB.setBackground(Color.green);
 
    Pan.add(JLB);
    Pan.add(JTA);
    Pan.add(JLB1);
    Pan.add(JTA1);
    Pan.add(JLB2);
    Pan.add(JTA2);
    Pan.add(JLB3);
    Pan.add(JTA3);
    Pan.add(JLB4);
    Pan.add(JTA4);
    Pan.add(JLB5);
    Pan.add(JTA5);
    Pan.add(JLB6);
    Pan.add(JTA6);
    Pan.add(JCB);
    Pan.add(JCB1);
    Pan.add(JB);
 
    }
 
    public void actionPerformed(ActionEvent e) {
        // throw new UnsupportedOperationException("Not supported yet."); //To  change body of generated methods, choose Tools | Templates.
    if(e.getSource()==JB){
    System.out.println("Formulaire validé");
    }
    else {
    System.out.println("Formulaire non validé");
    }
 
    }
 
 
 
 
}