本文整理汇总了Java中javax.swing.JFileChooser.isMultiSelectionEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java JFileChooser.isMultiSelectionEnabled方法的具体用法?Java JFileChooser.isMultiSelectionEnabled怎么用?Java JFileChooser.isMultiSelectionEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JFileChooser
的用法示例。
在下文中一共展示了JFileChooser.isMultiSelectionEnabled方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: open
import javax.swing.JFileChooser; //导入方法依赖的package包/类
void open() throws IOException {
JFileChooser chooser = haxby.map.MapApp.getFileChooser();
int mode = chooser.getFileSelectionMode();
boolean multi = chooser.isMultiSelectionEnabled();
chooser.setMultiSelectionEnabled( true );
chooser.setFileSelectionMode( JFileChooser.FILES_ONLY );
chooser.addChoosableFileFilter(imageFileFilter);
int ok = chooser.showOpenDialog(frame);
File[] choice = null;
if( ok!=chooser.CANCEL_OPTION ) choice = chooser.getSelectedFiles();
chooser.setMultiSelectionEnabled(multi);
chooser.setFileSelectionMode( mode );
chooser.removeChoosableFileFilter(imageFileFilter);
if( ok==chooser.CANCEL_OPTION ) {
return;
}
if (mapType == MapApp.MERCATOR_MAP)
openImagesMercator(choice);
else
openImagesPolar(choice);
}
示例2: actionPerformed
import javax.swing.JFileChooser; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
if (UIManager.getBoolean("FileChooser.readOnly")) {
return;
}
JFileChooser fc = getFileChooser();
File currentDirectory = fc.getCurrentDirectory();
FileSystemView fsv = fc.getFileSystemView();
File newFolder = null;
String name = SwingTools.showInputDialog("file_chooser.new_folder", "");
try {
if (name != null && !"".equals(name)) {
newFolder = fsv.createNewFolder(currentDirectory);
if (newFolder.renameTo(fsv.createFileObject(fsv.getParentDirectory(newFolder), name))) {
newFolder = fsv.createFileObject(fsv.getParentDirectory(newFolder), name);
} else {
SwingTools.showVerySimpleErrorMessage("file_chooser.new_folder.rename", name);
}
}
} catch (IOException exc) {
SwingTools.showVerySimpleErrorMessage("file_chooser.new_folder.create", name);
return;
} catch (Exception exp) {
// do nothing
}
if (fc.isMultiSelectionEnabled()) {
fc.setSelectedFiles(new File[] { newFolder });
} else {
fc.setSelectedFile(newFolder);
}
fc.rescanCurrentDirectory();
}
示例3: marathon_select
import javax.swing.JFileChooser; //导入方法依赖的package包/类
@Override public boolean marathon_select(String value) {
JFileChooser fc = (JFileChooser) component;
if (value.equals("")) {
fc.cancelSelection();
return true;
}
if (fc.isMultiSelectionEnabled()) {
fc.setSelectedFiles(ChooserHelper.decode(value));
fc.approveSelection();
return true;
}
fc.setSelectedFile(ChooserHelper.decodeFile(value));
fc.approveSelection();
return true;
}
示例4: recordApproveSelection
import javax.swing.JFileChooser; //导入方法依赖的package包/类
private void recordApproveSelection(JFileChooser fc) {
if (fc.isMultiSelectionEnabled()) {
File[] fs = fc.getSelectedFiles();
recorder.recordSelect(this, ChooserHelper.encode(fs));
} else {
File file = fc.getSelectedFile();
recorder.recordSelect(this, ChooserHelper.encode(file));
}
}
示例5: addResource
import javax.swing.JFileChooser; //导入方法依赖的package包/类
private void addResource(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addResource
// TODO add your handling code here:
JFileChooser chooser = new JFileChooser();
FileUtil.preventFileChooserSymlinkTraversal(chooser, null);
chooser.setAcceptAllFileFilterUsed(false);
if (this.volumeType.equals(PersistenceLibrarySupport.VOLUME_TYPE_CLASSPATH)) {
chooser.setMultiSelectionEnabled (true);
chooser.setDialogTitle(NbBundle.getMessage(J2SEVolumeCustomizer.class,"TXT_OpenClasses"));
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
chooser.setFileFilter (new SimpleFileFilter(NbBundle.getMessage(
J2SEVolumeCustomizer.class,"TXT_Classpath"),new String[] {"ZIP","JAR"})); //NOI18N
chooser.setApproveButtonText(NbBundle.getMessage(J2SEVolumeCustomizer.class,"CTL_SelectCP"));
chooser.setApproveButtonMnemonic(NbBundle.getMessage(J2SEVolumeCustomizer.class,"MNE_SelectCP").charAt(0));
}
else if (this.volumeType.equals(PersistenceLibrarySupport.VOLUME_TYPE_JAVADOC)) {
chooser.setDialogTitle(NbBundle.getMessage(J2SEVolumeCustomizer.class,"TXT_OpenJavadoc"));
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
chooser.setFileFilter (new SimpleFileFilter(NbBundle.getMessage(
J2SEVolumeCustomizer.class,"TXT_Javadoc"),new String[] {"ZIP","JAR"})); //NOI18N
chooser.setApproveButtonText(NbBundle.getMessage(J2SEVolumeCustomizer.class,"CTL_SelectJD"));
chooser.setApproveButtonMnemonic(NbBundle.getMessage(J2SEVolumeCustomizer.class,"MNE_SelectJD").charAt(0));
}
else if (this.volumeType.equals(PersistenceLibrarySupport.VOLUME_TYPE_SRC)) {
chooser.setDialogTitle(NbBundle.getMessage(J2SEVolumeCustomizer.class,"TXT_OpenSources"));
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
chooser.setFileFilter (new SimpleFileFilter(NbBundle.getMessage(
J2SEVolumeCustomizer.class,"TXT_Sources"),new String[] {"ZIP","JAR"})); //NOI18N
chooser.setApproveButtonText(NbBundle.getMessage(J2SEVolumeCustomizer.class,"CTL_SelectSRC"));
chooser.setApproveButtonMnemonic(NbBundle.getMessage(J2SEVolumeCustomizer.class,"MNE_SelectSRC").charAt(0));
}
if (lastFolder != null) {
chooser.setCurrentDirectory (lastFolder);
}
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
try {
lastFolder = chooser.getCurrentDirectory();
if (chooser.isMultiSelectionEnabled()) {
addFiles (chooser.getSelectedFiles());
}
else {
final File selectedFile = chooser.getSelectedFile();
addFiles (new File[] {selectedFile});
}
} catch (MalformedURLException mue) {
Exceptions.printStackTrace(mue);
}
}
}