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).

1  
static JComponent filePathInputWithBrowseButton(JTextField tf, O... _) {
2  
  ret centerAndEastWithMargin(tf, jbutton("Browse...", r {
3  
    JFileChooser fileChooser = new JFileChooser(getTextTrim(tf));
4  
    if (fileChooser.showOpenDialog(tf) == JFileChooser.APPROVE_OPTION) {
5  
      tf.setText(fileChooser.getSelectedFile().getAbsolutePath());
6  
      callF(optPar onChoose(_));
7  
    }
8  
  }));
9  
}

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: 289 / 402
Version history: 5 change(s)
Referenced in: [show references]