當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。