本文整理汇总了Java中javax.swing.JFileChooser.setMultiSelectionEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java JFileChooser.setMultiSelectionEnabled方法的具体用法?Java JFileChooser.setMultiSelectionEnabled怎么用?Java JFileChooser.setMultiSelectionEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JFileChooser
的用法示例。
在下文中一共展示了JFileChooser.setMultiSelectionEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doSelectLoggingFolder
import javax.swing.JFileChooser; //导入方法依赖的package包/类
public void doSelectLoggingFolder() {
if (loggingFolder == null || loggingFolder.isEmpty()) {
loggingFolder = System.getProperty("user.dir");
}
JFileChooser chooser = new JFileChooser(loggingFolder);
chooser.setDialogTitle("Choose data logging folder");
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setMultiSelectionEnabled(false);
int retval = chooser.showOpenDialog(getChip().getAeViewer().getFilterFrame());
if (retval == JFileChooser.APPROVE_OPTION) {
File f = chooser.getSelectedFile();
if (f != null && f.isDirectory()) {
setLoggingFolder(f.toString());
log.info("selected data logging folder " + loggingFolder);
} else {
log.warning("tried to select invalid logging folder named " + f);
}
}
}
示例2: actionPerformed
import javax.swing.JFileChooser; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser chooser = new JFileChooser(DocOpenAction.lastOpenedFileLocation);
chooser.setMultiSelectionEnabled(true);
chooser.setFileFilter(new FileFilter() {
@Override
public boolean accept(File file) {
DocOpenAction.lastOpenedFileLocation = file.getParent();
return
file.isDirectory() ||
(file.exists() && file.isFile() && file.canRead() && file.getName().toLowerCase().endsWith(".pdf"));
}
@Override
public String getDescription() {
return resources.getString("FILE_FILTER_PDF");
}
});
if (chooser.showOpenDialog(parent) == JFileChooser.APPROVE_OPTION) {
PdfJumbler.openFiles(list, -1, Arrays.asList(chooser.getSelectedFiles()));
}
}
示例3: showFileSelection
import javax.swing.JFileChooser; //导入方法依赖的package包/类
public static List<Data> showFileSelection() throws Exception{
List<Data> ret = new ArrayList<Data>();
JFileChooser jfc = new JFileChooser();
jfc.setMultiSelectionEnabled(true);
jfc.setDialogTitle("Choose the files to sign");
SignUtils.playBeeps(1);
if(jfc.showOpenDialog(null) != JFileChooser.APPROVE_OPTION)
return null;
File[] choosedFileList = jfc.getSelectedFiles();
for(File file:choosedFileList){
String id = file.getAbsolutePath();
byte[] fileContent = IOUtils.readFile(file);
ret.add(new Data(id, fileContent));
}
return ret;
}
示例4: onExportFilenameBrowseClick
import javax.swing.JFileChooser; //导入方法依赖的package包/类
private void onExportFilenameBrowseClick() {
File oldFile = getExecutableFile();
JFileChooser fileChooser = new AccessibleJFileChooser(NbBundle.getMessage(MercurialOptionsPanelController.class, "ACSD_ExportBrowseFolder"), oldFile); // NOI18N
fileChooser.setDialogTitle(NbBundle.getMessage(MercurialOptionsPanelController.class, "ExportBrowse_title")); // NOI18N
fileChooser.setMultiSelectionEnabled(false);
FileFilter[] old = fileChooser.getChoosableFileFilters();
for (int i = 0; i < old.length; i++) {
FileFilter fileFilter = old[i];
fileChooser.removeChoosableFileFilter(fileFilter);
}
fileChooser.showDialog(panel, NbBundle.getMessage(MercurialOptionsPanelController.class, "OK_Button")); // NOI18N
File f = fileChooser.getSelectedFile();
if (f != null) {
panel.exportFilenameTextField.setText(f.getAbsolutePath());
}
}
示例5: nativeIconButtonActionPerformed
import javax.swing.JFileChooser; //导入方法依赖的package包/类
private void nativeIconButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nativeIconButtonActionPerformed
JFileChooser chooser = new JFileChooser();
chooser.setCurrentDirectory(null);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
chooser.setMultiSelectionEnabled(false);
chooser.setFileFilter(new IconFileFilter(false));
String current = nativeIconTextField.getText();
File lastFolder = current!=null ? getFileFromPath(current) : null;
if (lastFolder != null) {
chooser.setSelectedFile(lastFolder);
} else if (lastImageFolder != null) {
chooser.setSelectedFile(lastImageFolder);
} else { // ???
// workDir = FileUtil.toFile(project.getProjectDirectory()).getAbsolutePath();
// chooser.setSelectedFile(new File(workDir));
}
chooser.setDialogTitle(NbBundle.getMessage(JFXIconsPanel.class, "LBL_Select_Icon_Image")); // NOI18N
if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) {
File file = FileUtil.normalizeFile(chooser.getSelectedFile());
String relPath = JFXProjectUtils.getRelativePath(project.getProjectDirectory(), FileUtil.toFileObject(file));
nativeIconTextField.setText(relPath);
lastImageFolder = file;
}
}
示例6: openFile
import javax.swing.JFileChooser; //导入方法依赖的package包/类
private File openFile() {
String home = System.getProperty("user.home"); // NOI18N
JFileChooser chooser = new JFileChooser(home);
chooser.setMultiSelectionEnabled(false);
chooser.setFileHidingEnabled(false);
int dlgResult = chooser.showOpenDialog(this);
if (JFileChooser.APPROVE_OPTION == dlgResult) {
File result = chooser.getSelectedFile();
if (result != null && !result.exists()) {
result = null;
}
return result;
} else {
return null;
}
}
示例7: loadLevel
import javax.swing.JFileChooser; //导入方法依赖的package包/类
private void loadLevel()
{
JFileChooser chooser = new JFileChooser(lastDir == null ? PathHelper.getDialogDirIfFound() : lastDir);
chooser.addChoosableFileFilter(filter);
chooser.setAcceptAllFileFilterUsed(true);
chooser.setMultiSelectionEnabled(false);
int result = chooser.showOpenDialog(this);
if (result == JFileChooser.APPROVE_OPTION)
{
saveButton.setEnabled(false);
replaceView(createLevelPanel);
level = null;
File selectedFile = chooser.getSelectedFile();
try {
level = DialogDataHelper.getDialogRoot(selectedFile);
lastDir = selectedFile.getParentFile();
saveButton.setEnabled(true);
} catch (Exception e) {
JOptionPane.showMessageDialog(this, "Beim Laden ist ein Fehler aufgetreten!\n" + e.getMessage(), "Fehler!", JOptionPane.OK_OPTION);
}
rebuildTree();
}
}
示例8: doSelectLoggingFolder
import javax.swing.JFileChooser; //导入方法依赖的package包/类
synchronized public void doSelectLoggingFolder() {
if (loggingFolder == null || loggingFolder.isEmpty()) {
loggingFolder = System.getProperty("user.dir");
}
JFileChooser chooser = new JFileChooser(loggingFolder);
chooser.setDialogTitle("Choose data logging folder");
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setMultiSelectionEnabled(false);
if (chooser.showOpenDialog(getChip().getAeViewer().getFilterFrame()) == JFileChooser.APPROVE_OPTION) {
File f = chooser.getSelectedFile();
if (f != null && f.isDirectory()) {
setLoggingFolder(f.toString());
log.log(Level.INFO, "Selected data logging folder {0}", loggingFolder);
} else {
log.log(Level.WARNING, "Tried to select invalid logging folder named {0}", f);
}
}
}
示例9: getFileChooser
import javax.swing.JFileChooser; //导入方法依赖的package包/类
private JFileChooser getFileChooser() {
if (fileChooser == null) {
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
chooser.setMultiSelectionEnabled(false);
chooser.setAcceptAllFileFilterUsed(false);
chooser.setDialogType(JFileChooser.OPEN_DIALOG);
chooser.setDialogTitle(Bundle.LocationCustomizer_ChooseFileDialogCaption());
chooser.setFileFilter(new FileFilter() {
public boolean accept(File f) {
return f.isDirectory() || f.getName().toLowerCase().endsWith(".java");
} // NOI18N
public String getDescription() {
return Bundle.LocationCustomizer_FileDialogFilterName();
}
});
fileChooser = chooser;
}
return fileChooser;
}
示例10: doImportGTfromMatlab
import javax.swing.JFileChooser; //导入方法依赖的package包/类
synchronized public void doImportGTfromMatlab() {
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle("Choose ground truth file");
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
chooser.setMultiSelectionEnabled(false);
if (chooser.showOpenDialog(chip.getAeViewer().getFilterFrame()) == JFileChooser.APPROVE_OPTION) {
try {
vxGTframe = ((MLDouble) (new MatFileReader(chooser.getSelectedFile().getPath())).getMLArray("vxGT")).getArray();
vyGTframe = ((MLDouble) (new MatFileReader(chooser.getSelectedFile().getPath())).getMLArray("vyGT")).getArray();
tsGTframe = ((MLDouble) (new MatFileReader(chooser.getSelectedFile().getPath())).getMLArray("ts")).getArray();
importedGTfromMatlab = true;
log.info("Imported ground truth file");
} catch (IOException ex) {
log.log(Level.SEVERE, null, ex);
}
}
}
示例11: showDialog
import javax.swing.JFileChooser; //导入方法依赖的package包/类
/**
* @param seletMode
* @return
*/
public String showDialog(int seletMode)
{
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(seletMode);
chooser.setMultiSelectionEnabled(true);//璁剧疆澶氶?鏂囦欢
int result = chooser.showOpenDialog(this);
if (result == JFileChooser.APPROVE_OPTION)
{
String filePath = chooser.getSelectedFile().getAbsolutePath();
return filePath;
}
return null;
}
示例12: selectFile
import javax.swing.JFileChooser; //导入方法依赖的package包/类
/**
* browse and select the attachment files
*/
private void selectFile() {
JFileChooser chooser = new JFileChooser(com.cognizant.cognizantits.ide.main.explorer.settings.Settings.getScreenShotLoc());
chooser.setMultiSelectionEnabled(true);
chooser.showOpenDialog(this);
File[] files = chooser.getSelectedFiles();
for (File f : files) {
attachments.setText(attachments.getText() + f.getAbsolutePath() + File.pathSeparator);
}
}
示例13: browseButtonActionPerformed
import javax.swing.JFileChooser; //导入方法依赖的package包/类
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed
final JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode (JFileChooser.FILES_ONLY);
chooser.setMultiSelectionEnabled(false);
chooser.setFileFilter(new SplashFileFilter());
if (lastImageFolder != null) {
chooser.setCurrentDirectory(lastImageFolder);
}
chooser.setDialogTitle(NbBundle.getMessage(CustomizerApplication.class, "LBL_Select_Splash_Image"));
if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) {
File file = FileUtil.normalizeFile(chooser.getSelectedFile());
splashTextField.setText(file.getAbsolutePath());
lastImageFolder = file.getParentFile();
}
}
示例14: chooseMossFileBtnActionPerformed
import javax.swing.JFileChooser; //导入方法依赖的package包/类
/**
* choose the files for moss
*/
private void chooseMossFileBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chooseMossFileBtnActionPerformed
// TODO add your handling code here:
JFileChooser chooseMoss = new JFileChooser();
chooseMoss.setFileSelectionMode(JFileChooser.FILES_ONLY);
chooseMoss.setMultiSelectionEnabled(true);
chooseMoss.showOpenDialog(this);
allMossFiles = chooseMoss.getSelectedFiles();
for(File f : allMossFiles) {
addedFilesArea.append(f.getAbsolutePath()+"\n");
}
}
示例15: onBrowse
import javax.swing.JFileChooser; //导入方法依赖的package包/类
protected void onBrowse(JTextField txt) {
File oldFile = FileUtil.normalizeFile(new File(txt.getText()));
JFileChooser fileChooser = new AccessibleJFileChooser(NbBundle.getMessage(Repository.class, "ACSD_BrowseCertFile"), oldFile); // NOI18N
fileChooser.setDialogTitle(NbBundle.getMessage(Repository.class, "Browse_title")); // NOI18N
fileChooser.setMultiSelectionEnabled(false);
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
fileChooser.showDialog(this.getPanel(), NbBundle.getMessage(Repository.class, "OK_Button")); // NOI18N
File f = fileChooser.getSelectedFile();
if (f != null) {
txt.setText(f.getAbsolutePath());
}
}