Bonjour, je suis sur un projet de renommage de fichiers et je souhaite charger une liste dans une liste temporaire afin de la classer et de la renommer ensuite pour l'afficher enfin dans une autre liste finale.
On m'a dit que je pourrai utiliser la fonction ArrayList mais je ne vois pas comment l'utiliser.
Auriez-vous une solution plus simple ou serait-il possible d'avoir des explications?
Voila 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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
import java.awt.*; 
import java.awt.event.*;
import java.io.IOException;
import java.util.ArrayList;
 
public class parcourir extends Frame 
{
	private static final long serialVersionUID = 1L;
	private Button            button1        = null;
	private Button            buttonSimul      = null;
	private Button            buttonValid   = null;
		private List              listeInit     = null;
	private List              listeModif     = null;
	private Checkbox          checkboxAlfa  = null;
	private Checkbox          checkboxOX = null;
	private Checkbox          checkboxXO  = null;
	private Checkbox          checkboxOrdre  = null;
	private ArrayList<String> listeAtrier = new ArrayList<String>();
 
	public parcourir()
	{
		super();
		initialize();
		openDialog = new FileDialog(this, "Open File", FileDialog.LOAD);
 
		this.setTitle("Parcourir");
		this.setLayout(new FlowLayout());
 
		this.setVisible(true);
		thisObject = this;
 
	}
	private Button getButton1()
	{
		if(button1==null)
		{
			this.setSize(new Dimension(435, 454));
			button1= new Button();
			button1.setLabel("Parcourir...");
			button1.setBounds(new Rectangle(32, 42, 156, 45));
			button1.addActionListener(new java.awt.event.ActionListener()
			{
				public void actionPerformed(java.awt.event.ActionEvent e)
				{
					openDialog.setVisible(true);
					fileName = openDialog.getFile();
					if (fileName != null ) 
 
						listeInit.add(fileName);
 
					thisObject.setTitle("Renommage  " + fileName);  
					buttonSimul.setEnabled(true);
 
				}
			});
		}
 
		return button1;
	}
	private Button getButtonSimul()
	{
		if (buttonSimul == null)
		{
			buttonSimul = new Button();
			buttonSimul.setBounds(new Rectangle(211, 46, 129, 38));
			buttonSimul.setEnabled(false);
			buttonSimul.setLabel("Simuler");
			buttonSimul.addActionListener(new java.awt.event.ActionListener()
			{
				public void actionPerformed(java.awt.event.ActionEvent e)
				{
					if (checkboxXO.getState())
					{
 
						if (checkboxAlfa.getState())
						{
 
						}
 
 
						if (checkboxOrdre.getState())
						{
 
						}
					}
					if (checkboxXO.getState())
					{
						if (checkboxAlfa.getState())
						{
 
						}
 
 
						if (checkboxOrdre.getState())
						{
 
						}
					}
				}
			});
		}
		return buttonSimul;
	}
 
	private Checkbox getCheckboxOX()
	{
		if (checkboxOX == null)
		{
			checkboxOX = new Checkbox();
			checkboxOX.setBounds(new Rectangle(500, 272, 112, 23));
			checkboxOX.setLabel("Fichier_OX");
		}
		return checkboxOX;
	}
	private Checkbox getCheckboxXO()
	{
		if (checkboxXO == null)
		{
			checkboxXO = new Checkbox();
			checkboxXO.setBounds(new Rectangle(500, 272, 112, 23));
			checkboxXO.setLabel("Fichier_XO");
		}
		return checkboxXO;
	}
 
	private Checkbox getCheckboxOrdre()
	{
		if (checkboxOrdre == null)
		{
			checkboxOrdre = new Checkbox();
			checkboxOrdre.setBounds(new Rectangle(500, 272, 112, 23));
			checkboxOrdre.setLabel("Ancienneté");
		}
		return checkboxOrdre;
	}
 
	/**
         * This method initializes checkboxListe
         * 
         * @return java.awt.Checkbox
         */
	private Checkbox getCheckboxAlfa()
	{
		if (checkboxAlfa == null)
		{
			checkboxAlfa = new Checkbox();
			checkboxAlfa.setBounds(new Rectangle(232, 316, 112, 23));
			checkboxAlfa.setLabel("Ordre alphabétique");
		}
		return checkboxAlfa;
	}
 
	private List getListeInit()
	{
		if (listeInit == null)
		{
			listeInit = new List();
			listeInit.setBounds(new Rectangle(50, 200, 300, 293));
			listeInit.setFont(new Font("Dialog", Font.PLAIN, 12));
		}
		return listeInit ;
	}
 
	private List getListeModif()
	{
		if (listeModif == null)
		{
			listeModif = new List();
			listeModif.setBounds(new Rectangle(33, 114, 188, 176));
			listeModif.setFont(new Font("Dialog", Font.PLAIN, 16));
			listeModif.addActionListener(new java.awt.event.ActionListener()
			{
				public void actionPerformed(java.awt.event.ActionEvent e)
				{
 
				}
			});
		}
		return listeModif ;
	}
 
 
 
 
	public static void main(String[] args) 
	{
		new parcourir().setVisible(true);
 
	}
 
	private void initialize()
	{
 
 
		this.setLayout(new FlowLayout());
		this.setSize(800,400);
		this.setBackground(Color.lightGray);
		this.setName("frame");
		this.setTitle("Renommage");
		this.add(getButton1(), null);
		this.add(getButtonSimul(), null);
		this.add(getCheckboxOX(), null);
		this.add(getCheckboxXO(), null);
		this.add(getCheckboxAlfa(), null);
		this.add(getCheckboxOrdre(), null);
		this.add(getListeInit(), null);
		this.add(getListeModif(), null);
 
 
		this.addWindowListener(new java.awt.event.WindowAdapter()
		{
			public void windowClosing(java.awt.event.WindowEvent e)
			{
				System.exit(0);
			}
		});
	}
 
 
	private String     fileName   = null;
	private FileDialog openDialog = null;
	Select       select       = null;
	private parcourir    thisObject = null;
 
 
}