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"); } }
Began life as a copy of #1006692
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1015950 |
| Snippet name: | inputDirPath - show input form for a directory path. Calls action in UI thread |
| Eternal ID of this version: | #1015950/5 |
| Text MD5: | 92220da1946a8d29c672a4cfdefaea2a |
| Author: | stefan |
| Category: | javax / gui |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-12-03 19:18:07 |
| Source code size: | 1073 bytes / 28 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 633 / 680 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |