Example usage for javax.swing JFileChooser setAcceptAllFileFilterUsed

List of usage examples for javax.swing JFileChooser setAcceptAllFileFilterUsed

Introduction

In this page you can find the example usage for javax.swing JFileChooser setAcceptAllFileFilterUsed.

Prototype

@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) 

Source Link

Document

Determines whether the AcceptAll FileFilter is used as an available choice in the choosable filter list.

Usage

From source file:lu.lippmann.cdb.ext.hydviga.ui.GapFillingKnowledgeDBExplorerFrame.java

/**
 * Constructor./*from  ww  w  . jav  a2s  . com*/
 */
GapFillingKnowledgeDBExplorerFrame(final Instances ds, final int dateIdx, final StationsDataProvider gcp)
        throws Exception {
    LogoHelper.setLogo(this);
    this.setTitle("KnowledgeDB: explorer");

    this.gcp = gcp;

    this.tablePanel = new JXPanel();
    this.tablePanel.setBorder(new TitledBorder("Cases"));

    final JXPanel highPanel = new JXPanel();
    highPanel.setLayout(new BoxLayout(highPanel, BoxLayout.X_AXIS));
    highPanel.add(this.tablePanel);

    this.geomapPanel = new JXPanel();
    this.geomapPanel.add(buildGeoMapChart(new ArrayList<String>(), new ArrayList<String>()));
    highPanel.add(this.geomapPanel);

    this.caseChartPanel = new JXPanel();
    this.caseChartPanel.setBorder(new TitledBorder("Inspected fake gap"));

    this.mostSimilarChartPanel = new JXPanel();
    this.mostSimilarChartPanel.setBorder(new TitledBorder("Most similar"));
    this.nearestChartPanel = new JXPanel();
    this.nearestChartPanel.setBorder(new TitledBorder("Nearest"));
    this.downstreamChartPanel = new JXPanel();
    this.downstreamChartPanel.setBorder(new TitledBorder("Downstream"));
    this.upstreamChartPanel = new JXPanel();
    this.upstreamChartPanel.setBorder(new TitledBorder("Upstream"));

    getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.PAGE_AXIS));
    //getContentPane().add(new JCheckBox("Use incomplete series"));
    getContentPane().add(highPanel);
    //getContentPane().add(new JXButton("Export"));      
    getContentPane().add(caseChartPanel);
    getContentPane().add(mostSimilarChartPanel);
    getContentPane().add(nearestChartPanel);
    getContentPane().add(downstreamChartPanel);
    getContentPane().add(upstreamChartPanel);

    //final Instances kdbDS=GapFillingKnowledgeDB.getKnowledgeDBWithBestCasesOnly();      
    final Instances kdbDS = GapFillingKnowledgeDB.getKnowledgeDB();

    final JXTable gapsTable = buidJXTable(kdbDS);
    final JScrollPane tableScrollPane = new JScrollPane(gapsTable);
    tableScrollPane.setPreferredSize(
            new Dimension(COMPONENT_WIDTH - 100, 40 + (int) (tableScrollPane.getPreferredSize().getHeight())));
    this.tablePanel.add(tableScrollPane);

    gapsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    gapsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(final ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) {
                final int modelRow = gapsTable.getSelectedRow();

                final String attrname = gapsTable.getModel().getValueAt(modelRow, 1).toString();
                final int gapsize = (int) Double
                        .valueOf(gapsTable.getModel().getValueAt(modelRow, 4).toString()).doubleValue();
                final int position = (int) Double
                        .valueOf(gapsTable.getModel().getValueAt(modelRow, 5).toString()).doubleValue();

                final String mostSimilarFlag = gapsTable.getModel().getValueAt(modelRow, 14).toString();
                final String nearestFlag = gapsTable.getModel().getValueAt(modelRow, 15).toString();
                final String downstreamFlag = gapsTable.getModel().getValueAt(modelRow, 16).toString();
                final String upstreamFlag = gapsTable.getModel().getValueAt(modelRow, 17).toString();

                final String algoname = gapsTable.getModel().getValueAt(modelRow, 12).toString();
                final boolean useDiscretizedTime = Boolean
                        .valueOf(gapsTable.getModel().getValueAt(modelRow, 13).toString());

                try {
                    geomapPanel.removeAll();

                    caseChartPanel.removeAll();

                    mostSimilarChartPanel.removeAll();
                    nearestChartPanel.removeAll();
                    downstreamChartPanel.removeAll();
                    upstreamChartPanel.removeAll();

                    final Set<String> selected = new HashSet<String>();

                    final Instances tmpds = WekaDataProcessingUtil.buildFilteredDataSet(ds, 0,
                            ds.numAttributes() - 1,
                            Math.max(0, position - GapsUtil.getCountOfValuesBeforeAndAfter(gapsize)),
                            Math.min(position + gapsize + GapsUtil.getCountOfValuesBeforeAndAfter(gapsize),
                                    ds.numInstances() - 1));

                    final List<String> attributeNames = WekaTimeSeriesUtil
                            .getNamesOfAttributesWithoutGap(tmpds);
                    //final List<String> attributeNames=WekaDataStatsUtil.getAttributeNames(ds);
                    attributeNames.remove(attrname);
                    attributeNames.remove("timestamp");

                    if (Boolean.valueOf(mostSimilarFlag)) {
                        final String mostSimilarStationName = WekaTimeSeriesSimilarityUtil
                                .findMostSimilarTimeSerie(tmpds, tmpds.attribute(attrname), attributeNames,
                                        false);
                        selected.add(mostSimilarStationName);
                        final Attribute mostSimilarStationAttr = tmpds.attribute(mostSimilarStationName);

                        final ChartPanel cp0 = GapsUIUtil.buildGapChartPanel(ds, dateIdx,
                                mostSimilarStationAttr, gapsize, position);
                        cp0.getChart().removeLegend();
                        cp0.setPreferredSize(CHART_DIMENSION);
                        mostSimilarChartPanel.add(cp0);
                    }

                    if (Boolean.valueOf(nearestFlag)) {
                        final String nearestStationName = gcp.findNearestStation(attrname, attributeNames);
                        selected.add(nearestStationName);
                        final Attribute nearestStationAttr = ds.attribute(nearestStationName);

                        final ChartPanel cp0 = GapsUIUtil.buildGapChartPanel(ds, dateIdx, nearestStationAttr,
                                gapsize, position);
                        cp0.getChart().removeLegend();
                        cp0.setPreferredSize(CHART_DIMENSION);
                        nearestChartPanel.add(cp0);
                    }

                    if (Boolean.valueOf(downstreamFlag)) {
                        final String downstreamStationName = gcp.findDownstreamStation(attrname,
                                attributeNames);
                        selected.add(downstreamStationName);
                        final Attribute downstreamStationAttr = ds.attribute(downstreamStationName);

                        final ChartPanel cp0 = GapsUIUtil.buildGapChartPanel(ds, dateIdx, downstreamStationAttr,
                                gapsize, position);
                        cp0.getChart().removeLegend();
                        cp0.setPreferredSize(CHART_DIMENSION);
                        downstreamChartPanel.add(cp0);
                    }

                    if (Boolean.valueOf(upstreamFlag)) {
                        final String upstreamStationName = gcp.findUpstreamStation(attrname, attributeNames);
                        selected.add(upstreamStationName);
                        final Attribute upstreamStationAttr = ds.attribute(upstreamStationName);

                        final ChartPanel cp0 = GapsUIUtil.buildGapChartPanel(ds, dateIdx, upstreamStationAttr,
                                gapsize, position);
                        cp0.getChart().removeLegend();
                        cp0.setPreferredSize(CHART_DIMENSION);
                        upstreamChartPanel.add(cp0);
                    }

                    final GapFiller gapFiller = GapFillerFactory.getGapFiller(algoname, useDiscretizedTime);
                    final ChartPanel cp = GapsUIUtil.buildGapChartPanelWithCorrection(ds, dateIdx,
                            ds.attribute(attrname), gapsize, position, gapFiller, selected);
                    cp.getChart().removeLegend();
                    cp.setPreferredSize(new Dimension((int) CHART_DIMENSION.getWidth(),
                            (int) (CHART_DIMENSION.getHeight() * 1.5)));
                    caseChartPanel.add(cp);

                    geomapPanel.add(buildGeoMapChart(Arrays.asList(attrname), selected));

                    getContentPane().repaint();
                    pack();
                } catch (Exception e1) {
                    e1.printStackTrace();
                }
            }
        }
    });

    gapsTable.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(final MouseEvent e) {
            if (!e.isPopupTrigger()) {
                // nothing?
            } else {
                final JPopupMenu jPopupMenu = new JPopupMenu("feur");

                final JMenuItem mExport = new JMenuItem("Export this table as CSV");
                mExport.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(final ActionEvent e) {
                        final JFileChooser fc = new JFileChooser();
                        fc.setAcceptAllFileFilterUsed(false);
                        final int returnVal = fc.showSaveDialog(gapsTable);
                        if (returnVal == JFileChooser.APPROVE_OPTION) {
                            try {
                                final File file = fc.getSelectedFile();
                                WekaDataAccessUtil.saveInstancesIntoCSVFile(kdbDS, file);
                            } catch (Exception ee) {
                                ee.printStackTrace();
                            }
                        }
                    }
                });
                jPopupMenu.add(mExport);

                jPopupMenu.show(gapsTable, e.getX(), e.getY());
            }
        }
    });

    setPreferredSize(new Dimension(FRAME_WIDTH, 1000));

    pack();
    setVisible(true);

    /* select the first row */
    gapsTable.setRowSelectionInterval(0, 0);
}

From source file:be.ugent.maf.cellmissy.gui.controller.TracksWriterController.java

/**
 * Choose Directory// w  w  w.java 2s  . c o  m
 */
private void chooseDirectory() {
    // Open a JFile Chooser
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setDialogTitle("Select directory to save the files");
    fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    fileChooser.setAcceptAllFileFilterUsed(false);
    // in response to the button click, show open dialog
    int returnVal = fileChooser.showOpenDialog(tracksWriterDialog);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
        directory = fileChooser.getSelectedFile();
    }
    tracksWriterDialog.getDirectoryTextField().setText(directory.getAbsolutePath());
}

From source file:colectordedatos.resultados.java

private void Exportar_a_ExcelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Exportar_a_ExcelActionPerformed
    if (jTable1.getRowCount() > 0) {
        JFileChooser chooser = new JFileChooser();
        FileNameExtensionFilter filter = new FileNameExtensionFilter("Archivos de excel", "xls");
        chooser.setFileFilter(filter);//from   w w w.  ja  va  2 s .  co  m
        chooser.setDialogTitle("Guardar archivo");
        chooser.setAcceptAllFileFilterUsed(false);
        if (chooser.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) {
            List<JTable> tb = new ArrayList<JTable>();
            List<String> nom = new ArrayList<String>();
            tb.add(jTable1);
            nom.add("Reporte de Errores");
            String file = chooser.getSelectedFile().toString().concat(".xls");
            try {
                exportaraexcel e = new exportaraexcel(new File(file), tb, nom);
                if (e.export()) {
                    JOptionPane.showMessageDialog(null,
                            "Los datos fueron exportados a excel en el directorio seleccionado",
                            "Mensaje de Informacion", JOptionPane.INFORMATION_MESSAGE);
                }
            } catch (Exception e) {
                JOptionPane.showMessageDialog(null, "Hubo un error " + e.getMessage(), " Error",
                        JOptionPane.ERROR_MESSAGE);
            }
        }
    } else {
        JOptionPane.showMessageDialog(this, "No hay datos para exportar", "Mensaje de error",
                JOptionPane.ERROR_MESSAGE);
    }
}

From source file:com.ficeto.esp.EspExceptionDecoder.java

private void createAndUpload() {
    if (!PreferencesData.get("target_platform").contentEquals("esp8266")
            && !PreferencesData.get("target_platform").contentEquals("esp32")
            && !PreferencesData.get("target_platform").contentEquals("ESP31B")) {
        System.err.println();//from   w ww  .java  2 s. c o m
        editor.statusError("Not Supported on " + PreferencesData.get("target_platform"));
        return;
    }

    String tc = "esp32";
    if (PreferencesData.get("target_platform").contentEquals("esp8266")) {
        tc = "lx106";
    }

    TargetPlatform platform = BaseNoGui.getTargetPlatform();

    String gccPath = PreferencesData.get("runtime.tools.xtensa-" + tc + "-elf-gcc.path");
    if (gccPath == null) {
        gccPath = platform.getFolder() + "/tools/xtensa-" + tc + "-elf";
    }

    String addr2line;
    if (PreferencesData.get("runtime.os").contentEquals("windows"))
        addr2line = "xtensa-" + tc + "-elf-addr2line.exe";
    else
        addr2line = "xtensa-" + tc + "-elf-addr2line";

    tool = new File(gccPath + "/bin", addr2line);
    if (!tool.exists() || !tool.isFile()) {
        System.err.println();
        editor.statusError("ERROR: " + addr2line + " not found!");
        return;
    }

    elf = new File(getBuildFolderPath(editor.getSketch()), editor.getSketch().getName() + ".ino.elf");
    if (!elf.exists() || !elf.isFile()) {
        elf = new File(getBuildFolderPath(editor.getSketch()), editor.getSketch().getName() + ".cpp.elf");
        if (!elf.exists() || !elf.isFile()) {
            //lets give the user a chance to select the elf
            final JFileChooser fc = new JFileChooser();
            fc.addChoosableFileFilter(new ElfFilter());
            fc.setAcceptAllFileFilterUsed(false);
            int returnVal = fc.showDialog(editor, "Select ELF");
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                elf = fc.getSelectedFile();
            } else {
                editor.statusError("ERROR: elf was not found!");
                System.err.println("Open command cancelled by user.");
                return;
            }
        }
    }

    JFrame.setDefaultLookAndFeelDecorated(true);
    frame = new JFrame("Exception Decoder");
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

    inputArea = new JTextArea("Paste your stack trace here", 16, 60);
    inputArea.setLineWrap(true);
    inputArea.setWrapStyleWord(true);
    inputArea.getInputMap().put(KeyStroke.getKeyStroke("ENTER"), "commit");
    inputArea.getActionMap().put("commit", new CommitAction());
    inputArea.getDocument().addDocumentListener(this);
    frame.getContentPane().add(new JScrollPane(inputArea), BorderLayout.PAGE_START);

    outputText = "";
    outputArea = new JTextPane();
    outputArea.setContentType("text/html");
    outputArea.setEditable(false);
    outputArea.setBackground(null);
    outputArea.setBorder(null);
    outputArea.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true);
    outputArea.setText(outputText);

    JScrollPane outputScrollPane = new JScrollPane(outputArea);
    outputScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    outputScrollPane.setPreferredSize(new Dimension(640, 200));
    outputScrollPane.setMinimumSize(new Dimension(10, 10));
    frame.getContentPane().add(outputScrollPane, BorderLayout.CENTER);

    frame.pack();
    frame.setVisible(true);
}

From source file:biz.wolschon.finance.jgnucash.panels.TaxReportPanel.java

/**
 * Show a dialog to export/*from   ww w  . j a  v  a2  s  .  com*/
 * a CSV-file that contains the
 * shown {@link TransactionSum}s
 * for each month, year or day.
 */
protected void showExportCSVDialog() {
    JFileChooser fc = new JFileChooser();
    fc.setAcceptAllFileFilterUsed(true);
    fc.addChoosableFileFilter(new FileFilter() {

        @Override
        public boolean accept(final File aF) {
            return aF.isDirectory() || aF.getName().endsWith(".csv");
        }

        @Override
        public String getDescription() {
            return "CSV-file";
        }
    });
    int dialogResult = fc.showSaveDialog(this);
    if (dialogResult != JFileChooser.APPROVE_OPTION) {
        return;
    }
    File file = fc.getSelectedFile();
    if (file.exists()) {
        int confirmation = JOptionPane.showConfirmDialog(this, "File exists. Replace file?");
        if (confirmation != JOptionPane.YES_OPTION) {
            showExportCSVDialog();
            return;
        }
    }
    ExportGranularities gran = (ExportGranularities) myExportGranularityCombobox.getSelectedItem();
    try {
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        exportCSV(file, gran);
    } finally {
        setCursor(Cursor.getDefaultCursor());
    }
}

From source file:com.nwn.NwnUpdaterHomeView.java

/**
 * Allow user to specify their NWN directory
 * @param evt /*from w ww  .  ja  va2s . com*/
 */
private void btnSelectNwnDirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSelectNwnDirActionPerformed
    JFileChooser fc = new JFileChooser();
    fc.setCurrentDirectory(new java.io.File("."));
    fc.setDialogTitle("NWN Updater");
    fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    fc.setAcceptAllFileFilterUsed(false);
    int returnVal = fc.showOpenDialog(txtNwnDir);
    if (returnVal == JFileChooser.APPROVE_OPTION) {
        File file = fc.getSelectedFile();
        txtNwnDir.setText(file.getAbsolutePath());
    }
}

From source file:dotaSoundEditor.Controls.ItemPanel.java

@Override
protected File promptUserForNewFile(String wavePath) {
    DefaultMutableTreeNode selectedTreeNode = (DefaultMutableTreeNode) getTreeNodeFromWavePath(wavePath);
    String waveString = selectedTreeNode.getUserObject().toString();
    String allowedExtension = FilenameUtils.getExtension(waveString).replace("\"", "");

    JFileChooser chooser = new JFileChooser(new File(UserPrefs.getInstance().getWorkingDirectory()));
    FileNameExtensionFilter filter = allowedExtension.equals("wav") ? new FileNameExtensionFilter("WAVs", "wav")
            : new FileNameExtensionFilter("MP3s", "mp3");
    chooser.setAcceptAllFileFilterUsed((false));
    chooser.setFileFilter(filter);/* w ww .  java2  s.  c  o  m*/
    chooser.setMultiSelectionEnabled(false);

    int chooserRetVal = chooser.showOpenDialog(chooser);
    if (chooserRetVal == JFileChooser.APPROVE_OPTION) {
        Path chosenFile = Paths.get(chooser.getSelectedFile().getAbsolutePath());

        int startIndex = -1;
        int endIndex = -1;
        //Get the actual value for the wavestring key-value pair.
        if (waveString.contains("\"wave\"")) {
            startIndex = Utility.nthOccurrence(selectedTreeNode.getUserObject().toString(), '\"', 2);
            endIndex = Utility.nthOccurrence(selectedTreeNode.getUserObject().toString(), '\"', 3);
        } else //Some wavestrings don't have the "wave" at the beginning for some reason
        {
            startIndex = Utility.nthOccurrence(selectedTreeNode.getUserObject().toString(), '\"', 0);
            endIndex = Utility.nthOccurrence(selectedTreeNode.getUserObject().toString(), '\"', 1);
        }
        String waveStringFilePath = waveString.substring(startIndex, endIndex + 1);
        String waveStringNormalizedFilePath = waveStringFilePath.substring(0,
                waveStringFilePath.lastIndexOf("\""));
        waveStringNormalizedFilePath = waveStringNormalizedFilePath.replace(")", "");
        waveStringNormalizedFilePath = waveStringNormalizedFilePath.replace("\"", "");

        Path destPath = Paths.get(installDir, "/dota/sound/" + waveStringNormalizedFilePath);
        UserPrefs.getInstance().setWorkingDirectory(chosenFile.getParent().toString());

        try {
            new File(destPath.toString()).mkdirs();
            Files.copy(chosenFile, destPath, StandardCopyOption.REPLACE_EXISTING);

            if (waveString.contains("//")) {
                waveString = waveString
                        .replace(waveString.substring(waveString.indexOf("//"), waveString.length()), "");
            }
            waveString = waveString.replace(waveStringFilePath, "\"" + waveStringNormalizedFilePath
                    + "\" //Replaced by: " + chosenFile.getFileName().toString());
            selectedTreeNode.setUserObject(waveString);

            //Write out modified tree to scriptfile.
            ScriptParser parser = new ScriptParser(this.currentTreeModel);
            String scriptString = getCurrentScriptString();
            Path scriptPath = Paths.get(scriptString);
            parser.writeModelToFile(scriptPath.toString());

            //Update UI
            ((DefaultMutableTreeNode) currentTree.getLastSelectedPathComponent()).setUserObject(waveString);
            ((DefaultTreeModel) currentTree.getModel())
                    .nodeChanged((DefaultMutableTreeNode) currentTree.getLastSelectedPathComponent());
            JOptionPane.showMessageDialog(this, "Sound file successfully replaced.");

        } catch (IOException ex) {
            JOptionPane.showMessageDialog(null, "Unable to replace sound.\nDetails: " + ex.getMessage(),
                    "Error", JOptionPane.ERROR_MESSAGE);
        }
    }
    return null;
}

From source file:net.aepik.alasca.gui.util.LoadFileFrame.java

/**
 * Perform action on event for this object.
 *///  www  .  ja  v  a  2s. com
public void actionPerformed(ActionEvent e) {
    Object o = e.getSource();
    if (o == boutonOpenFile) {
        JFileChooser jfcProgramme = new JFileChooser(".");
        jfcProgramme.setMultiSelectionEnabled(false);
        jfcProgramme.setDialogTitle("Selectionner un fichier");
        jfcProgramme.setApproveButtonText("Selectionner");
        jfcProgramme.setApproveButtonToolTipText("Cliquer apres avoir selectionn un fichier");
        jfcProgramme.setAcceptAllFileFilterUsed(false);
        if (jfcProgramme.showDialog(this, null) == JFileChooser.APPROVE_OPTION) {
            try {
                filename.setText(jfcProgramme.getSelectedFile().getCanonicalPath());
            } catch (IOException ioe) {
                JOptionPane.showMessageDialog(null, "Erreur de nom de fichier.", "Erreur",
                        JOptionPane.ERROR_MESSAGE);
            }
        }
    }
    if (o == boutonOk && filename.getText().length() != 0) {
        if (!this.loadFile(filename.getText(), (String) this.syntaxes.getSelectedItem())) {
            JOptionPane.showMessageDialog(this, this.getErrorMessage(), "Erreur", JOptionPane.ERROR_MESSAGE);
        } else {
            windowClosing(null);
        }
    }
    if (o == boutonAnnuler) {
        windowClosing(null);
    }
}

From source file:com.compomics.cell_coord.gui.controller.load.LoadTracksController.java

/**
 * Choose the directory and load its data into a given JTree.
 *
 * @param dataTree/*  w w  w .j a  v a2s  .  c  om*/
 */
private void chooseDirectoryAndLoadData() {
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setDialogTitle("Please select a root folder containing your files");
    // allow for directories only
    fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    // removing "All Files" option from FileType
    fileChooser.setAcceptAllFileFilterUsed(false);
    int returnVal = fileChooser.showOpenDialog(cellCoordController.getCellCoordFrame());
    if (returnVal == JFileChooser.APPROVE_OPTION) {
        // the directory for the data
        directory = fileChooser.getSelectedFile();
        try {
            loadDataIntoTree();
        } catch (LoadDirectoryException ex) {
            LOG.error(ex.getMessage());
            cellCoordController.showMessage(ex.getMessage(), "wrong directory structure error",
                    JOptionPane.ERROR_MESSAGE);
        }
    } else {
        cellCoordController.showMessage("Open command cancelled by user", "", JOptionPane.INFORMATION_MESSAGE);
    }
}

From source file:GUI.MyCustomFilter.java

private void NewFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_NewFileActionPerformed
    JFileChooser chooser = new JFileChooser();
    chooser.setCurrentDirectory(new java.io.File("."));
    chooser.setDialogTitle("choosertitle");
    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    chooser.setAcceptAllFileFilterUsed(false);

    if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
        String path = chooser.getSelectedFile().getAbsolutePath();
        String ext = FilenameUtils.getExtension(path);
        outputPath = path;//from w w w .  ja va  2s  .c o  m
        projectSelected = 1;
        //System.out.println("getCurrentDirectory(): " + chooser.getCurrentDirectory());
        //System.out.println("getSelectedFile() : " + chooser.getSelectedFile());
    } else {
        System.out.println("No Selection ");
    }
}