当前位置: 首页>>代码示例>>Java>>正文


Java JFileChooser.APPROVE_OPTION属性代码示例

本文整理汇总了Java中javax.swing.JFileChooser.APPROVE_OPTION属性的典型用法代码示例。如果您正苦于以下问题:Java JFileChooser.APPROVE_OPTION属性的具体用法?Java JFileChooser.APPROVE_OPTION怎么用?Java JFileChooser.APPROVE_OPTION使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.swing.JFileChooser的用法示例。


在下文中一共展示了JFileChooser.APPROVE_OPTION属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: certBrowseButtonActionPerformed

private void certBrowseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_certBrowseButtonActionPerformed
    JFileChooser chooser = new JFileChooser();
    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    chooser.setFileHidingEnabled(false);
    String text = UiUtils.getValue(certTextField);
    if (text != null) {
        chooser.setSelectedFile(new File(text));
    }
    if (chooser.showOpenDialog(SwingUtilities.getWindowAncestor(this)) == JFileChooser.APPROVE_OPTION) {
        certTextField.setText(chooser.getSelectedFile().getAbsolutePath());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:ConfigurationLinuxPanel.java

示例2: showFileSelection

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,代码行数:19,代码来源:SignUI.java

示例3: doLoadDataSetAndTrainSVM

public void doLoadDataSetAndTrainSVM() {                          //trains a SVM based on a prerecorded training file
    prob = null;
    prob2 = null;
    try {
        chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);  //choose a training data set
        chooser.setMultiSelectionEnabled(false);
        state = chooser.showOpenDialog(null);
        if (state == JFileChooser.APPROVE_OPTION) {
            int extInd = chooser.getSelectedFile().getCanonicalPath().lastIndexOf(".txt");
            String base = chooser.getSelectedFile().getCanonicalPath();
            if (extInd > 0) {
                base = chooser.getSelectedFile().getCanonicalPath().substring(0, extInd);   //ensure that the selected training file is a .txt file 
            }
            String filePath = String.format(base + ".txt");
            loadTrainingSet(filePath);                                                          //load the training data in a new problem
            log.info("Opened training data file: " + filePath);
            trainSVM(prob, param);
        }
    } catch (IOException e) {
        log.warning(e.toString());
    }
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:22,代码来源:CochleaSVMTwoEars.java

示例4: loadGml

/**
 *
 * @param args
 */
private GeometryImage loadGml() {
	GeometryImage positions =null;
	try{
     int returnVal = fd.showOpenDialog(null);
     if (returnVal == JFileChooser.APPROVE_OPTION) {
             lastDirectory = fd.getSelectedFile().getParent();
             ImageLayer l=LayerManager.getIstanceManager().getCurrentImageLayer();

        		GmlIO gmlIO=new GmlIO(fd.getSelectedFile(),(SarImageReader)l.getImageReader());
                positions = gmlIO.readLayer();
                if (positions.getProjection() != null) {
                	positions = GeometryImage.createImageProjected(positions, ((ImageLayer) l).getImageReader().getGeoTransform(), positions.getProjection());
                }
     }
 } catch (Exception ex) {
     logger.error(ex.getMessage(), ex);
     return null;
 }
	return positions;
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:24,代码来源:AddVectorConsoleAction.java

示例5: doSetPath

synchronized public void doSetPath() {
	JFileChooser j = new JFileChooser();
	j.setCurrentDirectory(new File(dirPath));
	j.setApproveButtonText("Select");
	j.setDialogTitle("Select a folder and base file name for calibration images");
	j.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); // let user specify a base filename
	int ret = j.showSaveDialog(null);
	if (ret != JFileChooser.APPROVE_OPTION) {
		return;
	}
	//imagesDirPath = j.getSelectedFile().getAbsolutePath();
	dirPath = j.getCurrentDirectory().getPath();
	fileBaseName = j.getSelectedFile().getName();
	if (!fileBaseName.isEmpty()) {
		fileBaseName = "-" + fileBaseName;
	}
	log.log(Level.INFO, "Changed images path to {0}", dirPath);
	putString("dirPath", dirPath);
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:19,代码来源:SingleOrStereoCameraCalibration.java

示例6: loadLevel

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,代码行数:25,代码来源:DialogEditor.java

示例7: browseLocationAction

private void browseLocationAction(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseLocationAction
    String command = evt.getActionCommand();
    
    if ("BROWSE".equals(command)) { //NOI18N
        JFileChooser chooser = new JFileChooser();
        chooser.setDialogTitle(NbBundle.getMessage(PanelProjectLocationVisual.class,"LBL_NWP1_SelectProjectLocation")); //NOI18N
        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        String path = projectLocationTextField.getText();
        if (path.length() > 0) {
            File f = new File(path);
            if (f.exists())
                chooser.setSelectedFile(f);
        }
        if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) {
            File projectDir = chooser.getSelectedFile();
            projectLocationTextField.setText(projectDir.getAbsolutePath());
        }            
        panel.fireChangeEvent();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:PanelProjectLocationVisual.java

示例8: chooseNbmFiles

public boolean chooseNbmFiles () {
    JFileChooser chooser = new JFileChooser ();
    chooser.setFileSelectionMode (JFileChooser.FILES_ONLY);
    chooser.addChoosableFileFilter (NBM_FILE_FILTER);
    chooser.addChoosableFileFilter (OSGI_BUNDLE_FILTER);
    chooser.setFileFilter (NBM_FILE_FILTER);
    chooser.setMultiSelectionEnabled (true);
    chooser.setFileHidingEnabled (false);
    chooser.setDialogTitle (NbBundle.getMessage(LocalDownloadSupport.class, "CTL_FileChooser_Title"));

    File dir = getDefaultDir ();
    if (dir != null && dir.exists ()) {
        chooser.setCurrentDirectory (dir);
    }

    Component parent = KeyboardFocusManager.getCurrentKeyboardFocusManager ().getActiveWindow ();
    if (chooser.showOpenDialog (parent) == JFileChooser.APPROVE_OPTION) {
        synchronized (LocalDownloadSupport.class) {
            getPreferences ().put (LOCAL_DOWNLOAD_DIRECTORY_KEY, chooser.getCurrentDirectory ().getAbsolutePath ());
            fileList.addFiles (chooser.getSelectedFiles ());
            addUpdateUnits (chooser.getSelectedFiles ());
        }
        return true;
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:LocalDownloadSupport.java

示例9: browseProjectLocation

private void browseProjectLocation(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseProjectLocation
    // TODO add your handling code here:
    JFileChooser chooser = new JFileChooser();
    chooser.setDialogTitle(NbBundle.getMessage(PanelSourceFolders.class, "LBL_NWP1_SelectProjectLocation")); // NOI18N
    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    String path = this.projectLocation.getText();
    if (path.length() > 0) {
        File f = new File(path);
        File owner = f.getParentFile();
        if (owner.exists()) {
            chooser.setCurrentDirectory(owner);
        }
        if (f.exists()) {
            chooser.setSelectedFile(f);
        }
    }
    if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
        File file = chooser.getSelectedFile();
        if (file != null) {
            this.projectLocation.setText(FileUtil.normalizeFile(file).getAbsolutePath());
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:PanelProjectLocationExtSrc.java

示例10: doLoadLogisimLibrary

public static void doLoadLogisimLibrary(Project proj) {
	Loader loader = proj.getLogisimFile().getLoader();
	JFileChooser chooser = loader.createChooser();
	chooser.setDialogTitle(Strings.get("loadLogisimDialogTitle"));
	chooser.setFileFilter(Loader.LOGISIM_FILTER);
	int check = chooser.showOpenDialog(proj.getFrame());
	if (check == JFileChooser.APPROVE_OPTION) {
		File f = chooser.getSelectedFile();
		Library lib = loader.loadLogisimLibrary(f);
		if (lib != null) {
			proj.doAction(LogisimFileActions.loadLibrary(lib));
		}
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:14,代码来源:ProjectLibraryActions.java

示例11: showLoadDialog

/**
 * 
 * @param title
 * @param dir
 * @param filter
 * @return
 * @throws Exception
 */
protected String showLoadDialog(String title, String dir, IOFileFilter filter) throws Exception {
    JFileChooser chooser = new JFileChooser(dir);
    chooser.setFileFilter(filter);
    chooser.setDialogTitle(title);
    int returnVal = chooser.showOpenDialog(this);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
        return (chooser.getSelectedFile().toString());
    }
    return (null);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:18,代码来源:AbstractViewer.java

示例12: bBrowseActionPerformed

private void bBrowseActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bBrowseActionPerformed
    JFileChooser filechooser = new JFileChooser (tDictionary.getText ());
    int ret = filechooser.showOpenDialog (null);
    if (ret == JFileChooser.APPROVE_OPTION)
        tDictionary.setText (filechooser.getSelectedFile ().getAbsolutePath ());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:DictionaryInstallerPanel.java

示例13: actionPerformed

@Override
public void actionPerformed(ActionEvent e) {
    JFileChooser chooser = new JFileChooser();
    chooser.setFileFilter(new FileFilter() {

        @Override
        public boolean accept(File f) {
            if (f.isFile()) {
                return f.getName().toLowerCase().endsWith(".xls");
            }
            return true;
        }

        @Override
        public String getDescription() {
            return "*.xls";
        }

    });
    int r = chooser.showOpenDialog(framework.getMainFrame());
    if (r == JFileChooser.APPROVE_OPTION) {
        Importer importer = new Importer(framework, tableView
                .getComponent().getRowSet(), ExcelPlugin.this);
        try {
            importer.importFromFile(chooser.getSelectedFile());
        } catch (IOException e1) {
            e1.printStackTrace();
            JOptionPane.showMessageDialog(framework.getMainFrame(), e1
                    .getLocalizedMessage());
        }
    }
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:32,代码来源:ExcelPlugin.java

示例14: filterUI

@Override
public File[] filterUI() {
	JFileChooser chooser = new JFileChooser();
	FileNameExtensionFilter filter = new FileNameExtensionFilter(
			"XML Files", "xml");
	chooser.setFileFilter(filter);
	chooser.setMultiSelectionEnabled(true);
	int returnVal = chooser.showOpenDialog(null);
	if(returnVal == JFileChooser.APPROVE_OPTION) {
		return chooser.getSelectedFiles();
	} else {
		return null;
	}
}
 
开发者ID:SERESLab,项目名称:iTrace-Archive,代码行数:14,代码来源:OldXMLBasicFixationFilter.java

示例15: browseWorkspaceButtonActionPerformed

private void browseWorkspaceButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseWorkspaceButtonActionPerformed
    JFileChooser chooser = new JFileChooser();
    FileUtil.preventFileChooserSymlinkTraversal(chooser, null);
    chooser.setFileSelectionMode (JFileChooser.DIRECTORIES_ONLY);
    chooser.setMultiSelectionEnabled(false);
    chooser.setDialogTitle(org.openide.util.NbBundle.getMessage(UpdateEclipseReferencePanel.class, "TITLE_Select_Eclipse_Workspace"));
    if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) {
        File file = FileUtil.normalizeFile(chooser.getSelectedFile());
        eclipseWorkspaceTextField.setText(file.getAbsolutePath());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:UpdateEclipseReferencePanel.java


注:本文中的javax.swing.JFileChooser.APPROVE_OPTION属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。