How to select multiple files using java.awt.FileDialog

橙三吉。 提交于 2019-11-28 08:26:26

问题


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



来源:https://stackoverflow.com/questions/5182100/how-to-select-multiple-files-using-java-awt-filedialog

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!