static void inputDirPath(fS msg, fO action) { inputDirPath(msg, userDir(), action); } // action: voidfunc(File) static void inputDirPath(fS msg, final File defaultDir, fO action) { awt { final JTextField tfPath = jtextfield(f2s(or(defaultDir, userDir()))); S title = joinStrings(" | ", msg, programName()); final Runnable ok = r { callF(action, new File(getTextTrim(tfPath))) }; JComponent form = showFormTitled(title, unnull(msg), centerAndEast(tfPath, jbutton("Browse...", r { JFileChooser fileChooser = new JFileChooser(getTextTrim(tfPath)); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setAcceptAllFileFilterUsed(false); if (fileChooser.showOpenDialog(tfPath) == JFileChooser.APPROVE_OPTION) { tfPath.setText(fileChooser.getSelectedFile().getAbsolutePath()); //tfPath.requestFocus(); callF(ok); disposePossiblyInternalFrame(tfPath); } })), ok); renameSubmitButton(form, "OK"); } }