private File loadFileChooser(javax.swing.filechooser.FileFilter ff, boolean isSave) {
        File result;
        JFileChooser fc = new JFileChooser(); //Create a file chooser
        fc.setAcceptAllFileFilterUsed(false);
        fc.setMultiSelectionEnabled(false);
        if(prevDir!=null)
            fc.setCurrentDirectory(prevDir);
        fc.setFileFilter(ff);
        if(!isSave) {
            fc.setDialogTitle("");
            if (fc.showDialog(null, "Select") == JFileChooser.APPROVE_OPTION) {
                result = fc.getSelectedFile();
            } else {
                result = null;
            }
        } else {
            fc.setDialogTitle("Save As...");
            if(fc.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) {
                result = fc.getSelectedFile();
            } else {
                result = null;
            }
        }
        if(result!=null)
            prevDir = result.getParentFile();
        return result;
    }