List of usage examples for javax.swing JFileChooser setAcceptAllFileFilterUsed
@BeanProperty(preferred = true, description = "Sets whether the AcceptAll FileFilter is used as an available choice in the choosable filter list.") public void setAcceptAllFileFilterUsed(boolean b)
AcceptAll FileFilter
is used as an available choice in the choosable filter list. From source file:net.sf.jabref.exporter.ExportFormats.java
private static JFileChooser createExportFileChooser(String currentDir) { String lastUsedFormat = Globals.prefs.get(JabRefPreferences.LAST_USED_EXPORT); FileFilter defaultFilter = null; JFileChooser fc = new JFileChooser(currentDir); Set<FileFilter> filters = new TreeSet<>(); for (Map.Entry<String, IExportFormat> e : ExportFormats.EXPORT_FORMATS.entrySet()) { String formatName = e.getKey(); IExportFormat format = e.getValue(); filters.add(format.getFileFilter()); if (formatName.equals(lastUsedFormat)) { defaultFilter = format.getFileFilter(); }//from w ww .java 2 s . c om } for (FileFilter ff : filters) { fc.addChoosableFileFilter(ff); } fc.setAcceptAllFileFilterUsed(false); if (defaultFilter != null) { fc.setFileFilter(defaultFilter); } return fc; }
From source file:org.pgptool.gui.ui.tools.browsefs.ExistingFileChooserDialog.java
private JFileChooser buildFileChooserDialog() { JFileChooser ofd = new JFileChooser(); ofd.setFileSelectionMode(JFileChooser.FILES_ONLY); ofd.setAcceptAllFileFilterUsed(true); ofd.setMultiSelectionEnabled(false); ofd.setDialogTitle(Messages.get("action.chooseExistingFile")); ofd.setApproveButtonText(Messages.get("action.choose")); suggestInitialDirectory(ofd);//from w w w . j a v a 2 s.co m doFileChooserPostConstruct(ofd); return ofd; }
From source file:org.pgptool.gui.ui.tools.browsefs.MultipleFilesChooserDialog.java
private JFileChooser buildFileChooserDialog() { JFileChooser ofd = new JFileChooser(); ofd.setFileSelectionMode(JFileChooser.FILES_ONLY); ofd.setAcceptAllFileFilterUsed(true); ofd.setMultiSelectionEnabled(true);//from www.j a va 2s . com ofd.setDialogTitle(Messages.get("action.chooseExistingFile")); ofd.setApproveButtonText(Messages.get("action.choose")); suggestInitialDirectory(ofd); doFileChooserPostConstruct(ofd); return ofd; }
From source file:de.peterspan.csv2db.ui.FileSelectionPanel.java
private JFileChooser getFileChooser() { JFileChooser fc = new JFileChooser(); fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); fc.setAcceptAllFileFilterUsed(false); fc.addChoosableFileFilter(new FileFilter() { @Override//from w w w.j av a2s . c o m public String getDescription() { return "CSV Files"; } @Override public boolean accept(File file) { if (file.isDirectory()) { return true; } return FilenameUtils.isExtension(file.getName().toLowerCase(), "csv"); } }); return fc; }
From source file:com.intuit.tank.proxy.settings.ui.ProxyConfigDialog.java
protected void openConfig() { JFileChooser fileChooser = new JFileChooser(); File file = new File("."); fileChooser.setCurrentDirectory(file); fileChooser.setAcceptAllFileFilterUsed(false); fileChooser.setFileFilter(new XmlFileFilter()); int showOpenDialog = fileChooser.showOpenDialog(this); if (showOpenDialog == JFileChooser.APPROVE_OPTION) { configHandler.setConfigFile(fileChooser.getSelectedFile().getAbsolutePath()); getProxyConfigPanel().update();/*from w w w .j a va2s . c om*/ } }
From source file:com.github.cmisbox.ui.UI.java
public File getWatchFolder() { JFileChooser chooser = new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setAcceptAllFileFilterUsed(false); chooser.showOpenDialog(null);//from w w w . java 2s.com return chooser.getSelectedFile(); }
From source file:com.intuit.tank.proxy.settings.ui.ProxyConfigDialog.java
private void save(int port, boolean followRedirecs, String outputFile, Set<ConfigInclusionExclusionRule> inclusions, Set<ConfigInclusionExclusionRule> exclusions, Set<ConfigInclusionExclusionRule> bodyInclusions, Set<ConfigInclusionExclusionRule> bodyExclusions, String configFileName) {//from w w w. j ava 2 s .c o m String fileName = ""; if (StringUtils.isEmpty(configFileName)) { JFileChooser fileChooser = new JFileChooser(); File file = new File("."); fileChooser.setCurrentDirectory(file); fileChooser.setAcceptAllFileFilterUsed(false); fileChooser.setFileFilter(new XmlFileFilter()); int showSaveDialog = fileChooser.showSaveDialog(this); if (showSaveDialog == JFileChooser.APPROVE_OPTION) { String selectedFile = fileChooser.getSelectedFile().getName(); if (!selectedFile.endsWith(".xml")) { selectedFile = selectedFile + ".xml"; } fileName = fileChooser.getSelectedFile().getParent() + "/" + selectedFile; configHandler.setConfigFile(fileName); } else { return; } } else { fileName = configFileName; } CommonsProxyConfiguration.save(port, followRedirecs, outputFile, inclusions, exclusions, bodyInclusions, bodyExclusions, fileName); getProxyConfigPanel().update(); configHandler.setConfigFile(fileName); }
From source file:com.moneydance.modules.features.importlist.io.DefaultDirectoryChooser.java
@Override void chooseBaseDirectory() { final JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle(this.getLocalizable().getDirectoryChooserTitle()); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); // disable the "All files" option. fileChooser.setAcceptAllFileFilterUsed(false); try {/*from w w w . j a v a2s. com*/ fileChooser.setCurrentDirectory(FileUtils.getUserDirectory()); } catch (SecurityException e) { LOG.log(Level.WARNING, e.getMessage(), e); } if (this.getBaseDirectory() != null) { final File parentDirectory = this.getBaseDirectory().getParentFile(); fileChooser.setCurrentDirectory(parentDirectory); } if (fileChooser.showOpenDialog(null) != JFileChooser.APPROVE_OPTION) { return; } this.getPrefs().setBaseDirectory(fileChooser.getSelectedFile().getAbsolutePath()); LOG.info(String.format("Base directory is %s", this.getPrefs().getBaseDirectory())); }
From source file:de.biomedical_imaging.ij.plot.HistogramPlotter.java
public HistogramPlotter(String title, String xlabel, double[][] data, int numberOfParticles, int meanTrackLength, IDatasetCreator datacreator) { super(title); this.title = title; this.xlabel = xlabel; this.numberOfParticles = numberOfParticles; this.meanTrackLength = meanTrackLength; IntervalXYDataset xydataset = datacreator.create(data); boolean isbarplot = (datacreator instanceof BarplotDataset); txt = new JLabel(); Font f = new Font("Verdana", Font.PLAIN, 12); txt.setFont(f);// w ww . ja va2 s . c o m JFreeChart chart = createChart(xydataset, isbarplot); ChartPanel chartPanel = new ChartPanel(chart); txt.setText(formatSettingsString()); main = new JPanel(); main.setPreferredSize(new java.awt.Dimension(500, 350)); main.add(chartPanel); main.add(txt); setContentPane(main); setLayout(new BoxLayout(main, BoxLayout.Y_AXIS)); pack(); setVisible(true); JMenuItem savebutton = ((JMenuItem) chartPanel.getPopupMenu().getComponent(3)); chartPanel.getPopupMenu().remove(3); // Remove Save button //ActionListener al = savebutton.getActionListeners()[0]; savebutton = new JMenuItem("Save as png"); //savebutton.removeActionListener(al); savebutton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub try { JFileChooser saveFile = new JFileChooser(); saveFile.setAcceptAllFileFilterUsed(false); saveFile.addChoosableFileFilter(new FileNameExtensionFilter("Images", "png")); int userSelection = saveFile.showSaveDialog(main); if (userSelection == JFileChooser.APPROVE_OPTION) { BufferedImage bi = ScreenImage.createImage(main); File fileToSave = saveFile.getSelectedFile(); String filename = fileToSave.getName(); int i = filename.lastIndexOf('.'); String suffix = filename.substring(i + 1); String path = fileToSave.getAbsolutePath(); if (!(suffix.equals("png"))) { path += ".png"; } ScreenImage.writeImage(bi, path); } } catch (IOException e) { // TODO Auto-generated catch block IJ.log("" + e.getMessage()); } } }); chartPanel.getPopupMenu().insert(savebutton, 3); }
From source file:de.burrotinto.jKabel.dbauswahlAS.DBAuswahlAAS.java
private String choosePath(String pfad) { JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(new java.io.File(pfad)); chooser.setDialogTitle("DB Pfad"); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setAcceptAllFileFilterUsed(false); return chooser.showOpenDialog(null) != JFileChooser.APPROVE_OPTION ? null : chooser.getSelectedFile().getPath() + File.separator; }