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


Java JFileChooser.setAcceptAllFileFilterUsed方法代碼示例

本文整理匯總了Java中javax.swing.JFileChooser.setAcceptAllFileFilterUsed方法的典型用法代碼示例。如果您正苦於以下問題:Java JFileChooser.setAcceptAllFileFilterUsed方法的具體用法?Java JFileChooser.setAcceptAllFileFilterUsed怎麽用?Java JFileChooser.setAcceptAllFileFilterUsed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JFileChooser的用法示例。


在下文中一共展示了JFileChooser.setAcceptAllFileFilterUsed方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: checkBrowser

import javax.swing.JFileChooser; //導入方法依賴的package包/類
public static boolean checkBrowser() {
    AppList appList = MimeTypesList.getAppList();
    String bpath = appList.getBrowserExec();
    if (bpath != null)
        if (new File(bpath).isFile())
            return true;
    JFileChooser chooser = new JFileChooser();
    chooser.setFileHidingEnabled(false);
    chooser.setDialogTitle(Local.getString("Select the web-browser executable"));
    chooser.setAcceptAllFileFilterUsed(true);
    chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
    /*java.io.File lastSel = (java.io.File) Context.get("LAST_SELECTED_RESOURCE_FILE");
    if (lastSel != null)
        chooser.setCurrentDirectory(lastSel);*/
    if (chooser.showOpenDialog(App.getFrame()) != JFileChooser.APPROVE_OPTION)
        return false;
    appList.setBrowserExec(chooser.getSelectedFile().getPath());
    CurrentStorage.get().storeMimeTypesList();
    return true;
}
 
開發者ID:ser316asu,項目名稱:SER316-Ingolstadt,代碼行數:21,代碼來源:Util.java

示例2: jBtnBrowseActionPerformed

import javax.swing.JFileChooser; //導入方法依賴的package包/類
private void jBtnBrowseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnBrowseActionPerformed

    jRbnFilesystem.setSelected(false);
    jRbnFilesystem.setSelected(true);
    enableControls();

    JFileChooser chooser = new JFileChooser(previousDirectory);
    chooser.setMultiSelectionEnabled(false);
    chooser.setAcceptAllFileFilterUsed(false);
    chooser.addChoosableFileFilter(WSDL_FILE_FILTER);
    chooser.setFileFilter(WSDL_FILE_FILTER);

    if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
        File wsdlFile = chooser.getSelectedFile();
        jTxtLocalFilename.setText(wsdlFile.getAbsolutePath());
        previousDirectory = wsdlFile.getPath();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:AddWebServiceDlg.java

示例3: selectDirectoryPath

import javax.swing.JFileChooser; //導入方法依賴的package包/類
@SuppressWarnings("unused")
private String selectDirectoryPath() {
	String path = "";
	JFileChooser chooser = new JFileChooser();
    // chooser.setCurrentDirectory(new java.io.File("."));
    chooser.setDialogTitle("Select a destination folder for your reports !");
    chooser.setCurrentDirectory(new File("current workspace ?"));
    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    chooser.setAcceptAllFileFilterUsed(false);

    if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION)
    	path = chooser.getSelectedFile().toString();
    else
    	path = "";
    return path;
}
 
開發者ID:cetic,項目名稱:SimQRI,代碼行數:17,代碼來源:ReportManager.java

示例4: open

import javax.swing.JFileChooser; //導入方法依賴的package包/類
public void open(final JPanel panel) {
	JFileChooser chooser = new JFileChooser();
    chooser.setCurrentDirectory(new File(System.getProperty("user.dir")));
    chooser.setDialogTitle("Choose Directory");
    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    chooser.setAcceptAllFileFilterUsed(false);

    if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
      dir = chooser.getSelectedFile().toString();
    } else {
      System.err.println("Could not open Dir");
      return;
    }
}
 
開發者ID:JudgeGlass,項目名稱:Install_Builder_Universal,代碼行數:15,代碼來源:OpenDirectory.java

示例5: buttonChooseFolderActionPerformed

import javax.swing.JFileChooser; //導入方法依賴的package包/類
private void buttonChooseFolderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonChooseFolderActionPerformed
    String lastFile = ConfigManager.loadConfig(boxArch, boxLimit, sliderQuality, labelQualityValue, false, boxProcessCount);
    JFileChooser chooser = new JFileChooser(lastFile);
    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    chooser.setAcceptAllFileFilterUsed(false);
    if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
        sourceFolderComplete.clear();
        ConfigManager.saveConfig(chooser.getSelectedFile().getAbsolutePath().toString(), boxArch.getSelectedIndex(), boxLimit.getSelectedIndex(), sliderQuality.getValue(), boxProcessCount.getSelectedIndex());
        displayDirectoryContents(chooser.getSelectedFile());
        textFieldSelectedFile.setText(chooser.getSelectedFile().getAbsolutePath().toString() + "\\*->*_guetzli.jpg");
        buttonConvert.setEnabled(true);
        convertType = "folder";
    }
}
 
開發者ID:polygOnetic,項目名稱:guetzliconverter,代碼行數:15,代碼來源:GuetzliConverter.java

示例6: ShowDlgSaveDiagrama

import javax.swing.JFileChooser; //導入方法依賴的package包/類
public static File ShowDlgSaveDiagrama(JComponent form, Diagrama diag) {
    JFileChooser f = new JFileChooser();
    //f.setDialogTitle(Editor.fromConfiguracao.getValor("Controler.dlg.modelo.salvar"));
    f.setFileSelectionMode(JFileChooser.FILES_ONLY);

    FileFilter filter = new FileNameExtensionFilter("BrModelo(bin)", Arquivo.brM3);
    FileFilter filter2 = new FileNameExtensionFilter("BrModelo(xml)", Arquivo.xml);
    f.addChoosableFileFilter(filter);
    f.addChoosableFileFilter(filter2);
    f.setAcceptAllFileFilterUsed(false);
    f.setFileFilter(filter);
    if (dir.isEmpty()) dir = System.getProperty("user.dir");
    f.setCurrentDirectory(new File(dir + "."));
    f.setDialogTitle(Editor.fromConfiguracao.getValor("Controler.MSG_SAVE_TITLE") + " " + diag.getNomeFormatado());
    if (!diag.getNome().isEmpty()){ 
        f.setSelectedFile(new File(diag.getNome()));
    }
    //f.setApproveButtonText(Editor.fromConfiguracao.getValor("Controler.dlg.modelo.salvar"));
    int returnVal = f.showSaveDialog(form);
    //int returnVal = f.showDialog(form, Editor.fromConfiguracao.getValor("Controler.dlg.modelo.salvar"));

    if (returnVal == JFileChooser.APPROVE_OPTION) {
        File file = f.getSelectedFile();
        String ext = Arquivo.getExtension(file);
        if (ext == null) {
            ext = "";
        }
        String arq = file.getAbsolutePath();
        dir = f.getCurrentDirectory().getAbsolutePath();
        if (f.getFileFilter().equals(filter) && !Arquivo.brM3.toUpperCase().equals(ext.toUpperCase())) {
            return new File(arq + "." + Arquivo.brM3);
        }
        if (f.getFileFilter().equals(filter2) && !Arquivo.xml.toUpperCase().equals(ext.toUpperCase())) {
            return new File(arq + "." + Arquivo.xml);
        }
        return file;
    } else {
        return null;
    }
}
 
開發者ID:chcandido,項目名稱:brModelo,代碼行數:41,代碼來源:Dialogos.java

示例7: save

import javax.swing.JFileChooser; //導入方法依賴的package包/類
/**
 * Shows a file chooser and exports the plot to the selected image file.
 * @throws IOException if an error occurs during writing.
 */
public void save() throws IOException {
    JFileChooser fc = FileChooser.getInstance();
    fc.setFileFilter(FileChooser.SimpleFileFilter.getWritableImageFIlter());
    fc.setAcceptAllFileFilterUsed(false);
    fc.setSelectedFiles(new File[0]);
    int returnVal = fc.showSaveDialog(this);

    if (returnVal == JFileChooser.APPROVE_OPTION) {
        File file = fc.getSelectedFile();
        save(file);
    }        
}
 
開發者ID:takun2s,項目名稱:smile_1.5.0_java7,代碼行數:17,代碼來源:PlotPanel.java

示例8: selectAppBrowseB_actionPerformed

import javax.swing.JFileChooser; //導入方法依賴的package包/類
void selectAppBrowseB_actionPerformed(ActionEvent e) {
// Fix until Sun's JVM supports more locales...
UIManager.put("FileChooser.lookInLabelText", Local.getString("Look in:"));
UIManager.put("FileChooser.upFolderToolTipText", Local.getString("Up One Level"));
UIManager.put("FileChooser.newFolderToolTipText", Local.getString("Create New Folder"));
UIManager.put("FileChooser.listViewButtonToolTipText", Local.getString("List"));
UIManager.put("FileChooser.detailsViewButtonToolTipText", Local.getString("Details"));
UIManager.put("FileChooser.fileNameLabelText", Local.getString("File Name:"));
UIManager.put("FileChooser.filesOfTypeLabelText", Local.getString("Files of Type:"));
UIManager.put("FileChooser.openButtonText", Local.getString("Open"));
UIManager.put("FileChooser.openButtonToolTipText", Local.getString("Open selected file"));
UIManager.put("FileChooser.cancelButtonText", Local.getString("Cancel"));
UIManager.put("FileChooser.cancelButtonToolTipText", Local.getString("Cancel"));
UIManager.put("FileChooser.acceptAllFileFilterText", Local.getString("All Files") + " (*.*)");

JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle(Local.getString("Path to executable"));
chooser.setFileHidingEnabled(false);
chooser.setAcceptAllFileFilterUsed(true);
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
if (System.getProperty("os.name").startsWith("Win")) {
    chooser.setFileFilter(new AllFilesFilter(AllFilesFilter.EXE));
    chooser.setCurrentDirectory(new File("C:\\Program Files"));
}
chooser.setPreferredSize(new Dimension(550, 375));
/*
    java.io.File lastSel = (java.io.File) Context.get("LAST_SELECTED_IMPORT_FILE");
    if (lastSel != null)
        chooser.setCurrentDirectory(lastSel);
*/
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
    applicationField.setText(chooser.getSelectedFile().getPath());
}
 
開發者ID:ser316asu,項目名稱:SER316-Dresden,代碼行數:34,代碼來源:SetApplicationPanel.java

示例9: showSaveDialog

import javax.swing.JFileChooser; //導入方法依賴的package包/類
private boolean showSaveDialog() {
	JFileChooser fc = new JFileChooser(Settings.EPISODES_PATH);
	
	fc.setDialogTitle("Save level");
	
	fc.setAcceptAllFileFilterUsed(false);
	
	fc.setFileFilter(new FileFilter() {

		@Override
		public boolean accept(File f) {
			return f.isDirectory() || f.getName().endsWith("map") && f.getName().length() < 39;
		}

		@Override
		public String getDescription() {
			return "Pekka Kana 2 level";
		}
		
	});
	
	int res = fc.showSaveDialog(frame);
	
	if (res == JFileChooser.APPROVE_OPTION) {
		Data.currentFile = fc.getSelectedFile();
		saveLevel(fc.getSelectedFile());
		
		return true;
	}
	
	return false;
}
 
開發者ID:Detea,項目名稱:PekaED,代碼行數:33,代碼來源:PekaEDGUI.java

示例10: doDialog

import javax.swing.JFileChooser; //導入方法依賴的package包/類
private static DialogResult doDialog(Component parent, boolean isOpenDialog, String title, FileFilter filter,
	boolean acceptAllFilter, File defaultFile)
{
	JFileChooser chooser = new JFileChooser(getDirectory());
	if( title != null )
	{
		chooser.setDialogTitle(title);
	}
	if( filter != null )
	{
		chooser.setFileFilter(filter);
	}
	if( defaultFile != null )
	{
		chooser.setSelectedFile(defaultFile);
	}
	if( !acceptAllFilter )
	{
		chooser.setAcceptAllFileFilterUsed(false);
	}

	int result = 0;
	if( isOpenDialog )
	{
		result = chooser.showOpenDialog(parent);
	}
	else
	{
		result = chooser.showSaveDialog(parent);
	}
	return new DialogResult(result, chooser.getSelectedFile(), chooser.getCurrentDirectory());
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:33,代碼來源:DialogUtils.java

示例11: addZipFolder

import javax.swing.JFileChooser; //導入方法依賴的package包/類
private void addZipFolder(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addZipFolder
    JFileChooser chooser = new JFileChooser(ModuleUISettings.getDefault().getLastUsedNbPlatformLocation());
    chooser.setAcceptAllFileFilterUsed(false);
    chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
    chooser.setFileFilter(new FileFilter() {
        public boolean accept(File f)  {
            return f.isDirectory() ||
                    f.getName().toLowerCase(Locale.US).endsWith(".jar") || // NOI18N
                    f.getName().toLowerCase(Locale.US).endsWith(".zip"); // NOI18N
        }
        public String getDescription() {
            return getMessage("CTL_JavadocTab");
        }
    });
    int ret = chooser.showOpenDialog(this);
    if (ret == JFileChooser.APPROVE_OPTION) {
        File javadocRoot = FileUtil.normalizeFile(chooser.getSelectedFile());
        URL newUrl = FileUtil.urlForArchiveOrDir(javadocRoot);
        if (model.containsRoot(newUrl)) {
            DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(
                getMessage("MSG_ExistingJavadocRoot")));
        } else {
            ModuleUISettings.getDefault().setLastUsedNbPlatformLocation(javadocRoot.getParentFile().getAbsolutePath());
            model.addJavadocRoot(newUrl);
            javadocList.setSelectedValue(newUrl, true);
        }
    }
    // XXX support adding Javadoc URL too (see java.j2seplatform)
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:30,代碼來源:NbPlatformCustomizerJavadoc.java

示例12: LoadDialog

import javax.swing.JFileChooser; //導入方法依賴的package包/類
/**
 * Creates a dialog to choose a file to load.
 *
 * @param freeColClient The {@code FreeColClient} for the game.
 * @param frame The owner frame.
 * @param directory The directory to display when choosing the file.
 * @param fileFilters The available file filters in the dialog.
 */
public LoadDialog(FreeColClient freeColClient, JFrame frame,
        File directory, FileFilter[] fileFilters) {
    super(freeColClient, frame);

    final JFileChooser fileChooser = new JFileChooser(directory);
    if (fileFilters.length > 0) {
        for (FileFilter fileFilter : fileFilters) {
            fileChooser.addChoosableFileFilter(fileFilter);
        }
        fileChooser.setFileFilter(fileFilters[0]);
        fileChooser.setAcceptAllFileFilterUsed(false);
    }
    fileChooser.setControlButtonsAreShown(true);
    fileChooser.setApproveButtonText(Messages.message("ok"));
    //fileChooser.setCancelButtonText(Messages.message("cancel"));
    fileChooser.setDialogType(JFileChooser.OPEN_DIALOG);
    fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
    fileChooser.setFileHidingEnabled(false);
    fileChooser.addActionListener((ActionEvent ae) -> {
            final String cmd = ae.getActionCommand();
            File value = (JFileChooser.APPROVE_SELECTION.equals(cmd))
                ? ((JFileChooser)ae.getSource()).getSelectedFile()
                : cancelFile;
            setValue(value);
        });

    List<ChoiceItem<File>> c = choices();
    initializeDialog(frame, DialogType.QUESTION, true, fileChooser, null, c);
}
 
開發者ID:FreeCol,項目名稱:freecol,代碼行數:38,代碼來源:LoadDialog.java

示例13: ShowDlgLoadDiagrama

import javax.swing.JFileChooser; //導入方法依賴的package包/類
/**
 * param preDir = pode ser diretório ou arquivo (não importa)
 * @param preDir
 * @param master
 * @return 
 */
public static File ShowDlgLoadDiagrama(String preDir, Editor master) {
    JFileChooser f = new JFileChooser();
    f.setFileSelectionMode(JFileChooser.FILES_ONLY);

    f.setFileFilter(new FileNameExtensionFilter("BrModelo", Arquivo.brM3, Arquivo.xml));
    f.addChoosableFileFilter(new FileNameExtensionFilter("BrModelo(bin)", Arquivo.brM3));
    f.addChoosableFileFilter(new FileNameExtensionFilter("BrModelo(xml)", Arquivo.xml));
    f.setAcceptAllFileFilterUsed(true);
    
    if (preDir == null || "".equals(preDir)) {
        f.setCurrentDirectory(new File(System.getProperty("user.dir")));
    } else {
        File f2 = new File(preDir);
        if (f2.isDirectory()) {
            f.setCurrentDirectory(f2);
        } else {
            f.setCurrentDirectory(new File(f2.getPath()));
        }
    }

    //f.setApproveButtonText(Editor.fromConfiguracao.getValor("Controler.dlg.modelo.abrir"));
    int returnVal = f.showOpenDialog((Component) master.getFramePrincipal());

    if (returnVal == JFileChooser.APPROVE_OPTION) {
        File file = f.getSelectedFile();
        if (!file.exists()) {
            return null;
        }
        return file;
    } else {
        return null;
    }
}
 
開發者ID:chcandido,項目名稱:brModelo,代碼行數:40,代碼來源:Dialogos.java

示例14: getDirectory

import javax.swing.JFileChooser; //導入方法依賴的package包/類
static String getDirectory() {
    JFileChooser chooser = new JFileChooser();
    chooser.setCurrentDirectory(new java.io.File("~"));
    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    chooser.setAcceptAllFileFilterUsed(false);
    if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
        return chooser.getSelectedFile().getAbsolutePath();
    }
    return null;
}
 
開發者ID:jatanrathod,項目名稱:Idea-Plagiarism,代碼行數:11,代碼來源:GUI.java

示例15: createChooser

import javax.swing.JFileChooser; //導入方法依賴的package包/類
private static JFileChooser createChooser() {
    JFileChooser chooser = new JFileChooser();
    FileUtil.preventFileChooserSymlinkTraversal(chooser, null);
    chooser.setFileSelectionMode( JFileChooser.DIRECTORIES_ONLY );
    chooser.setAcceptAllFileFilterUsed( false );
    chooser.setName( "Select Project Directory" ); // XXX // NOI18N
    return chooser;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:PanelProjectLocationVisual.java


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