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