Bonjour,
J'aurai voulu utiliser un JFileChooser pour permettre de selectionné un REPERTOIRE et seulement un REPERTOIRE,
mais je n'ai pas trouvé la syntaxe
qlqun peut m'aider?
Version imprimable
Bonjour,
J'aurai voulu utiliser un JFileChooser pour permettre de selectionné un REPERTOIRE et seulement un REPERTOIRE,
mais je n'ai pas trouvé la syntaxe
qlqun peut m'aider?
fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
ca ne fonctionne pas je suis obligé de selectionné un fichier pour valider...
voici un extrait de code
Code:
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 public JButton getInsertButton() { if(insertButton == null) { insertButton = new JButton("Insert"); insertButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { JFileChooser fileChooser = new JFileChooser(); fileChooser.showOpenDialog(null); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); mainIHMPorteEchantillonLauncher.insert(fileChooser.getSelectedFile().getAbsolutePath()); mainIHMPorteEchantillonLauncher2.insert(fileChooser.getSelectedFile().getAbsolutePath()); mainIHMPorteEchantillonLauncher3.insert(fileChooser.getSelectedFile().getAbsolutePath()); mainIHMPorteEchantillonLauncher4.insert(fileChooser.getSelectedFile().getAbsolutePath()); mainIHMPorteEchantillonLauncher5.insert(fileChooser.getSelectedFile().getAbsolutePath()); } }); } return insertButton; }
trouver j'ai juste inverser les deux ligne
Code:
1
2 fileChooser.showOpenDialog(null); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);