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


Java JFileChooser.isMultiSelectionEnabled方法代碼示例

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

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

示例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;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:16,代碼來源:JFileChooserJavaElement.java

示例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));
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:10,代碼來源:RFileChooser.java

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


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