src/main/java/eu/digitisation/output/OutputFileSelector.java
public File choose(File dir, File file) {
        // Use last choice
        if (OutputFileSelector.dir == null) {
            OutputFileSelector.dir = dir;
        }
        setCurrentDirectory(OutputFileSelector.dir);
        setSelectedFile(file);

        int returnVal = showOpenDialog(OutputFileSelector.this);

        if (returnVal == JFileChooser.APPROVE_OPTION) {
            File selection = getSelectedFile();
            OutputFileSelector.dir = selection.getParentFile();

            if (selection != null && selection.exists()) {
                int response = JOptionPane.showConfirmDialog(new JFrame().getContentPane(),
                        "The file " + selection.getName()
                        + " already exists.\n"
                        + "Do you want to replace the existing file?",
                        "Overwrite file", JOptionPane.YES_NO_OPTION,
                        JOptionPane.WARNING_MESSAGE);

                return (response == JOptionPane.YES_NO_OPTION) ? selection : null;
            }
            return selection;
        }
        return null;
    }
/**
     *
     * @param dir the default directory
     * @param file the preselected selection
     * @return the selected selection
     */
@param dir the default directory
@param file the preselected selection
@return the selected selection
@param dir the default directory @param file the preselected selection @return the selected selection
public File choose(File dir, File file) {
        if (OutputFileSelector.dir == null) {
            OutputFileSelector.dir = dir;
        }
        setCurrentDirectory(OutputFileSelector.dir);
        setSelectedFile(file);
        int returnVal = showOpenDialog(OutputFileSelector.this);
        if (returnVal == JFileChooser.APPROVE_OPTION) {
            File selection = getSelectedFile();
            OutputFileSelector.dir = selection.getParentFile();
            if (selection != null && selection.exists()) {
                int response = JOptionPane.showConfirmDialog(new JFrame().getContentPane(),
                        "The file " + selection.getName()
                        + " already exists.\n"
                        + "Do you want to replace the existing file?",
                        "Overwrite file", JOptionPane.YES_NO_OPTION,
                        JOptionPane.WARNING_MESSAGE);
                return (response == JOptionPane.YES_NO_OPTION) ? selection : null;
            }
            return selection;
        }
        return null;
    }
public File choose ( File dir , File file ) { if ( OutputFileSelector . dir == null ) { OutputFileSelector . dir = dir ; } setCurrentDirectory ( OutputFileSelector . dir ) ; setSelectedFile ( file ) ; int returnVal = showOpenDialog ( OutputFileSelector . this ) ; if ( returnVal == JFileChooser . APPROVE_OPTION ) { File selection = getSelectedFile ( ) ; OutputFileSelector . dir = selection . getParentFile ( ) ; if ( selection != null && selection . exists ( ) ) { int response = JOptionPane . showConfirmDialog ( new JFrame ( ) . getContentPane ( ) , "The file " + selection . getName ( ) + " already exists.\n" + "Do you want to replace the existing file?" , "Overwrite file" , JOptionPane . YES_NO_OPTION , JOptionPane . WARNING_MESSAGE ) ; return ( response == JOptionPane . YES_NO_OPTION ) ? selection : null ; } return selection ; } return null ; }
@param dir the default directory
 @param file the preselected selection
 @return the selected selection
@param dir the default directory @param file the preselected selection @return the selected selection
// Use last choice