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:pt.ua.dicoogle.rGUI.client.windows.MainWindow.java
private void dcm2JPEG(int thumbnailSize) { /**/* ww w . j ava 2 s. com*/ * Why couldn't? It works! if (System.getProperty("os.name").toUpperCase().indexOf("MAC OS") != -1) { JOptionPane.showMessageDialog(this, "Operation Not Available to MAC OS.", "Missing JAI Tool", JOptionPane.WARNING_MESSAGE); return; } */ String pathDir = "."; JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(new java.io.File(pathDir)); chooser.setDialogTitle("Dicoogle Dcm2JPG - Select DICOM File"); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); //chooser.setFileFilter(arg0) chooser.setAcceptAllFileFilterUsed(false); if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { File filePath = new File(chooser.getSelectedFile().toString()); if (filePath.exists() && filePath.isFile() && filePath.canRead()) { File jpgFile = new File(filePath.getAbsolutePath() + ".jpg"); Dicom2JPEG.convertDicom2Jpeg(filePath, jpgFile, thumbnailSize); } } }
From source file:quake3mapfixer.Pk3Fixer.java
private void fileChooserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileChooserActionPerformed Boolean old = UIManager.getBoolean("FileChooser.readOnly"); UIManager.put("FileChooser.readOnly", Boolean.TRUE); JFileChooser chooser = new JFileChooser(); UIManager.put("FileChooser.readOnly", old); FileNameExtensionFilter pk3filter = new FileNameExtensionFilter("pk3 files (*.pk3)", "pk3"); chooser.setFileFilter(pk3filter);/*from w w w . j a v a2 s.c o m*/ chooser.setAcceptAllFileFilterUsed(false); chooser.setDialogTitle("Open pk3 file"); if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { currentDirectory = chooser.getCurrentDirectory().toString(); selectedFile = chooser.getSelectedFile().toString(); absolutePath = chooser.getSelectedFile().getName(); areaFileName.setText(selectedFile); fileFixer.setEnabled(true); } }
From source file:ro.nextreports.designer.action.report.ViewReportSqlAction.java
public void actionPerformed(ActionEvent e) { JFileChooser fc = new JFileChooser(); fc.setDialogTitle(I18NSupport.getString("select.next.reports.file")); fc.setAcceptAllFileFilterUsed(false); fc.addChoosableFileFilter(new NextFileFilter()); int returnVal = fc.showOpenDialog(Globals.getMainFrame()); if (returnVal == JFileChooser.APPROVE_OPTION) { File f = fc.getSelectedFile(); if (f != null) { String sql = null;//from w w w .j ava 2s.com String entityName = null; Object entity = null; FileInputStream fis = null; entityName = f.getName(); try { XStream xstream = XStreamFactory.createXStream(); fis = new FileInputStream(f); entity = xstream.fromXML(fis); } catch (Exception ex) { Show.error(ex); } finally { if (fis != null) { try { fis.close(); } catch (IOException e1) { e1.printStackTrace(); } } } if (entityName.endsWith(QueryFilter.QUERY_EXTENSION) || entityName.endsWith(ReportFilter.REPORT_EXTENSION)) { Report report = (Report) entity; if (report.getSql() != null) { sql = report.getSql(); } else if (report.getQuery() != null) { SelectQuery query = report.getQuery(); try { query.setDialect(DialectUtil.getDialect(Globals.getConnection())); } catch (Exception ex) { ex.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. LOG.error(ex.getMessage(), ex); } sql = query.toString(); } } else if (entityName.endsWith(ChartFilter.CHART_EXTENSION)) { Chart chart = (Chart) entity; if (chart.getReport().getSql() != null) { sql = chart.getReport().getSql(); } else if (chart.getReport().getQuery() != null) { SelectQuery query = chart.getReport().getQuery(); try { query.setDialect(DialectUtil.getDialect(Globals.getConnection())); } catch (Exception ex) { ex.printStackTrace(); LOG.error(ex.getMessage(), ex); } sql = query.toString(); } } Editor editor = new Editor(); editor.setText(sql); editor.setPreferredSize(new Dimension(400, 400)); JFrame frame = new JFrame(I18NSupport.getString("view.sql.info", entityName)); frame.setIconImage(ImageUtil.getImageIcon("report_view").getImage()); frame.setLayout(new GridBagLayout()); frame.add(editor, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(10, 10, 10, 10), 0, 0)); frame.pack(); Show.centrateComponent(Globals.getMainFrame(), frame); frame.setVisible(true); } } }
From source file:View.Main.java
private void jButton_loadImageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_loadImageActionPerformed // TODO add your handling code here: jLabel_status.setText(" "); JFileChooser fc = new JFileChooser(); Double rating;//w w w . j ava 2 s.c o m fc.setFileSelectionMode(JFileChooser.FILES_ONLY); fc.addChoosableFileFilter(new FileNameExtensionFilter("JPEG files", "jpeg", "jpg")); fc.addChoosableFileFilter(new FileNameExtensionFilter("PNG files", "png", "PNG")); fc.addChoosableFileFilter(new FileNameExtensionFilter("BMP files", "bmp", "BMP")); fc.setAcceptAllFileFilterUsed(true); int returnVal = fc.showOpenDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { imagePath = fc.getSelectedFile().getAbsolutePath(); rating = imageAnalizer.getRating(imagePath); setTextRating(rating); populateProgressBar(rating); try { setImage(imagePath); } catch (IOException ex) { JOptionPane.showMessageDialog(null, "Please select an image of valid format", "Error", JOptionPane.WARNING_MESSAGE); //Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex); } getNews(rating); } // else { // JOptionPane.showMessageDialog(null, "Please select an image of valid format", "Error", JOptionPane.WARNING_MESSAGE); // } }
From source file:view.WorkspacePanel.java
public void signBatch(CCSignatureSettings settings) { ArrayList<File> toSignList = mainWindow.getOpenedFiles(); try {//w ww . j a v a2 s . c om if (tempCCAlias.getMainCertificate().getPublicKey().equals( CCInstance.getInstance().loadKeyStoreAndAliases().get(0).getMainCertificate().getPublicKey())) { String dest = null; Object[] options = { Bundle.getBundle().getString("opt.saveInOriginalFolder"), Bundle.getBundle().getString("msg.choosePath"), Bundle.getBundle().getString("btn.cancel") }; int i = JOptionPane.showOptionDialog(null, Bundle.getBundle().getString("msg.chooseSignedPath"), "", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); if (i == 1) { JFileChooser chooser = new JFileChooser(); chooser.setCurrentDirectory(new java.io.File(".")); chooser.setDialogTitle(Bundle.getBundle().getString("btn.choosePath")); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); chooser.setAcceptAllFileFilterUsed(false); if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { dest = chooser.getSelectedFile().getAbsolutePath(); } else { return; } } else if (i == 2) { return; } MultipleSignDialog msd = new MultipleSignDialog(mainWindow, true, toSignList, settings, dest); msd.setLocationRelativeTo(null); msd.setVisible(true); ArrayList<File> signedDocsList = msd.getSignedDocsList(); if (!signedDocsList.isEmpty()) { removeTempSignature(); clearSignatureFields(); hideRightPanel(); status = Status.READY; mainWindow.closeDocuments(mainWindow.getOpenedFiles(), false); for (File f : signedDocsList) { mainWindow.loadPdf(f, false); } } return; } else { JOptionPane.showMessageDialog(mainWindow, Bundle.getBundle().getString("msg.smartcardRemovedOrChanged"), WordUtils.capitalize(Bundle.getBundle().getString("error")), JOptionPane.ERROR_MESSAGE); } } catch (LibraryNotLoadedException | KeyStoreNotLoadedException | CertificateException | KeyStoreException | LibraryNotFoundException | AliasException ex) { controller.Logger.getLogger().addEntry(ex); } JOptionPane.showMessageDialog(mainWindow, Bundle.getBundle().getString("msg.smartcardRemovedOrChanged"), WordUtils.capitalize(Bundle.getBundle().getString("error")), JOptionPane.ERROR_MESSAGE); }
From source file:xtrememp.PlaylistManager.java
public void openPlaylistDialog() { JFileChooser fileChooser = new JFileChooser(Settings.getLastDir()); fileChooser.setAcceptAllFileFilterUsed(false); fileChooser.addChoosableFileFilter(playlistFileFilter); fileChooser.setMultiSelectionEnabled(false); if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); Settings.setLastDir(file.getPath()); clearPlaylist();//from w w w . j a v a 2 s .c o m loadPlaylist(file.getPath()); } }
From source file:xtrememp.PlaylistManager.java
public boolean savePlaylistDialog() { JFileChooser fileChooser = new JFileChooser(Settings.getLastDir()); M3uPlaylistFileFilter m3uFileFilter = new M3uPlaylistFileFilter(); XspfPlaylistFileFilter xspfFileFilter = new XspfPlaylistFileFilter(); fileChooser.setAcceptAllFileFilterUsed(false); fileChooser.addChoosableFileFilter(m3uFileFilter); fileChooser.addChoosableFileFilter(xspfFileFilter); fileChooser.setMultiSelectionEnabled(false); if (fileChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); FileFilter fileFilter = fileChooser.getFileFilter(); String fileName = file.getName().toLowerCase(); if (fileFilter == m3uFileFilter) { if (!fileName.endsWith(".m3u")) { fileName = fileName.concat(".m3u"); }/*from w w w .ja va2 s.co m*/ try { return PlaylistIO.saveM3U(playlist, file.getParent() + File.separator + fileName); } catch (PlaylistException ex) { logger.error("Can't save playlist in M3U format", ex); } } if (fileFilter == xspfFileFilter) { if (!fileName.endsWith(".xspf")) { fileName = fileName.concat(".xspf"); } try { return PlaylistIO.saveXSPF(playlist, file.getParent() + File.separator + fileName); } catch (PlaylistException ex) { logger.error("Can't save playlist in XSPF format", ex); } } Settings.setLastDir(file.getParent()); } return false; }
From source file:xtrememp.PlaylistManager.java
public void addFilesDialog(boolean playFirst) { JFileChooser fileChooser = new JFileChooser(Settings.getLastDir()); fileChooser.setAcceptAllFileFilterUsed(false); fileChooser.addChoosableFileFilter(audioFileFilter); fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); fileChooser.setMultiSelectionEnabled(true); if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { File[] selectedFiles = fileChooser.getSelectedFiles(); Settings.setLastDir(selectedFiles[0].getParent()); addFiles(Arrays.asList(selectedFiles), playFirst); }/*from w ww . ja v a 2 s. co m*/ }