當前位置: 首頁>>代碼示例>>Java>>正文


Java JFileChooser.setMultiSelectionEnabled方法代碼示例

本文整理匯總了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);
        }
    }
}
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:20,代碼來源:DataLogger.java

示例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()));
	}
}
 
開發者ID:mgropp,項目名稱:pdfjumbler,代碼行數:25,代碼來源:PdfJumbler.java

示例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;
}
 
開發者ID:damianofalcioni,項目名稱:Websocket-Smart-Card-Signer,代碼行數:20,代碼來源:SignUI.java

示例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());
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:MercurialOptionsPanelController.java

示例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;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:JFXIconsPanel.java

示例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;
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:SSHKeysPanel.java

示例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();
    }
}
 
開發者ID:Entwicklerpages,項目名稱:school-game,代碼行數:26,代碼來源:DialogEditor.java

示例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);
        }
    }
}
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:19,代碼來源:AbstractMotionFlowIMU.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:LocationCustomizer.java

示例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);
        }
    }
}
 
開發者ID:SensorsINI,項目名稱:jaer,代碼行數:18,代碼來源:AbstractMotionFlowIMU.java

示例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;
}
 
開發者ID:sxei,項目名稱:myqq,代碼行數:18,代碼來源:SendFileFrame.java

示例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);
    }
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:13,代碼來源:ReportDefect.java

示例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();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:CustomizerApplication.java

示例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");
    }
}
 
開發者ID:bufferhe4d,項目名稱:call-IDE,代碼行數:16,代碼來源:InsMain.java

示例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());
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:ConnectionType.java


注:本文中的javax.swing.JFileChooser.setMultiSelectionEnabled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。