当前位置: 首页>>代码示例>>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;未经允许,请勿转载。