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"); } }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1006692 |
| Snippet name: | inputFilePath - show input form for a file path |
| Eternal ID of this version: | #1006692/14 |
| Text MD5: | f2b1543523901ccc9bf11e16ff509d0d |
| Author: | stefan |
| Category: | javax / gui |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-05-31 17:44:00 |
| Source code size: | 848 bytes / 22 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 801 / 837 |
| Version history: | 13 change(s) |
| Referenced in: | [show references] |