How to select multiple files using java.awt.FileDi

2020-02-14 05:29发布

问题:

Is it possible to select multiple files using java.awt.FileDialog?

Because I want my dialog to have the OSX finder interface, I can't use JFileChooser.

回答1:

According to Javadoc it seems to be possible in JDK7 (see setMultipleMode(boolean) or getFiles() which returns an array of files). However cross checking with the Javadoc for JDK6 it is not possible in older versions...



回答2:

You just need to set the options (default is false)

setMultiSelectionEnabled(true)

http://download.oracle.com/javase/7/docs/api/javax/swing/JFileChooser.html#setMultiSelectionEnabled(boolean)



回答3:

Here's another question that talks about how to make JFileChooser look correct on OS-X, maybe that will help.

JFileChooser on OS-X



标签: java awt