|
15 | 15 | import java.io.File;
|
16 | 16 | import java.io.IOException;
|
17 | 17 | import java.util.ArrayList;
|
18 |
| -import java.util.Arrays; |
19 | 18 | import java.util.List;
|
20 |
| -import java.util.Objects; |
21 | 19 | import java.util.prefs.BackingStoreException;
|
22 | 20 | import java.util.prefs.Preferences;
|
23 | 21 |
|
|
26 | 24 | import javax.swing.BorderFactory;
|
27 | 25 | import javax.swing.Box;
|
28 | 26 | import javax.swing.BoxLayout;
|
| 27 | +import javax.swing.DefaultListModel; |
29 | 28 | import javax.swing.ImageIcon;
|
30 | 29 | import javax.swing.JButton;
|
31 | 30 | import javax.swing.JCheckBox;
|
@@ -314,12 +313,16 @@ public void actionPerformed(ActionEvent e) {
|
314 | 313 | jfc.setCurrentDirectory(Filesystem.getMinecraftDir());
|
315 | 314 | jfc.showDialog(Settings.this, Messages.getString("TexsplitDialog.SEL_RP"));
|
316 | 315 |
|
| 316 | + DefaultListModel<File> listPacksModel = listPacks.getModel(); |
317 | 317 | File[] selectedFiles = jfc.getSelectedFiles();
|
318 | 318 |
|
319 |
| - List<File> selectedFilesList = Arrays.asList(selectedFiles); |
320 |
| - selectedFilesList.removeIf(Objects::isNull); |
321 |
| - |
322 |
| - listPacks.getModel().addAll(0, selectedFilesList); |
| 319 | + for (File selectedFile : selectedFiles) { |
| 320 | + if (selectedFile == null) { |
| 321 | + return; |
| 322 | + } |
| 323 | + |
| 324 | + listPacksModel.add(0, selectedFile); |
| 325 | + } |
323 | 326 |
|
324 | 327 | listPacks.setSelectedIndex(0);
|
325 | 328 | saveSettings();
|
|
0 commit comments