Bonjour,

J'aimerais savoir comment recueillir des info de JTextField

Voici mon code
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
import java.awt.*;
import javax.swing.*;
 
public class Code extends JFrame {
    public Code(){
        this.setLayout(new GridLayout(3,2));
        this.add(new JLabel("prénom: "));
        this.add(new JTextField(20));
        this.add(new JLabel("nom: "));
        this.add(new JTextField(20));
        this.add(new JLabel("pays: "));
        this.add(new JTextField(20));
    }
 
    public static void main(String[] args){
        Code frame = new Code();
        frame.pack();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    }
Quelqu'un aurait-il un exemple (pas obligatoirement avec "prénom: ", "nom: "et "pays: ") ?

Merci d'avance pour votre aide.