Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

9
LINES

< > BotCompany Repo | #1024591 // filePathInputWithBrowseButton

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3179L/21K).

static JComponent filePathInputWithBrowseButton(JTextField tf, O... _) {
  ret centerAndEastWithMargin(tf, jbutton("Browse...", r {
    JFileChooser fileChooser = new JFileChooser(getTextTrim(tf));
    if (fileChooser.showOpenDialog(tf) == JFileChooser.APPROVE_OPTION) {
      tf.setText(fileChooser.getSelectedFile().getAbsolutePath());
      callF(optPar onChoose(_));
    }
  }));
}

Author comment

Began life as a copy of #1006692

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024591
Snippet name: filePathInputWithBrowseButton
Eternal ID of this version: #1024591/6
Text MD5: fa136f44e93ffca40969c53b55075ba9
Transpilation MD5: e9614710444a0062cae7a6a848b84885
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-20 13:51:46
Source code size: 393 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 182 / 258
Version history: 5 change(s)
Referenced in: [show references]