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()); 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(); } })), r { callF(action, new File(getTextTrim(tfPath))) }); renameSubmitButton(form, "OK"); } }