bonjour,
en fait je veux créer une interface graphique avec plus 100 champs et je voulais faire une boucle pour récupérer les infos saisies dans chaque champs et les afficher
et voici ce que j'ai commencé :

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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import java.awt.EventQueue;
import java.awt.TextField;
 
import javax.swing.Action;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.JButton;
 
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
 
 
public class liste {
 
	private JFrame frame;
	private JTextField textField;
	private JTextField textField_1;
	private JTextField textField_2;
	private JTextField textField_3;
	private JTextField textField_4;
	private JTextField textField_5;
 
	/**
         * Launch the application.
         */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					liste window = new liste();
					window.frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}
	ArrayList<liste> list = new ArrayList<>();
 
	{
 
    list.add(this);	
 
	}
 
 
	/**
         * Create the application.
         */
	public liste() {
		initialize();
 
	}
 
 
 
 
	/**
         * Initialize the contents of the frame.
         */
	private void initialize() {
		frame = new JFrame();
		frame.setBounds(100, 100, 450, 300);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.getContentPane().setLayout(null);
 
		textField = new JTextField();
		textField.setBounds(15, 30, 146, 26);
		frame.getContentPane().add(textField);
		textField.setColumns(10);
 
		textField_1 = new JTextField();
		textField_1.setBounds(15, 103, 146, 26);
		frame.getContentPane().add(textField_1);
		textField_1.setColumns(10);
 
		textField_2 = new JTextField();
		textField_2.setBounds(15, 177, 146, 26);
		frame.getContentPane().add(textField_2);
		textField_2.setColumns(10);
 
		textField_3 = new JTextField();
		textField_3.setBounds(225, 30, 146, 26);
		frame.getContentPane().add(textField_3);
		textField_3.setColumns(10);
 
		textField_4 = new JTextField();
		textField_4.setBounds(225, 103, 146, 26);
		frame.getContentPane().add(textField_4);
		textField_4.setColumns(10);
 
		textField_5 = new JTextField();
		textField_5.setBounds(239, 177, 146, 26);
		frame.getContentPane().add(textField_5);
		textField_5.setColumns(10);
 
		JButton btnNewButton = new JButton("New button");
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e)  {
				String textfield0 = textField.getText();
				String textfield1 = textField_1.getText();
				String textfield2 = textField_2.getText();
				String textfield3 = textField_3.getText();
				String textfield4 = textField_4.getText();
				String textfield5= textField_5.getText();
 
				System.out.println(textfield0);
				System.out.println(textfield1);
				System.out.println(textfield2);
				System.out.println(textfield3);
				System.out.println(textfield4);
				System.out.println(textfield5);
 
 
 
			}
 
 
 
		});
		btnNewButton.setBounds(121, 219, 115, 29);
		frame.getContentPane().add(btnNewButton);
	}
}