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

12
LINES

< > BotCompany Repo | #1022588 - jThreadedButton - make JButton running in new thread & holding button instance

JavaX fragment (include)

// action can be Runnable or a function name
static JButton jThreadedButton(fS text, fO action) {
  ret swing(func -> JButton {
    S text2 = dropPrefix("[disabled] ", text);
    final JButton btn = new JButton(text2);
    if (l(text2) < l(text)) btn.setEnabled(false);
    btn.setToolTipText(btn.getText());
    if (action != null)
      btn.addActionListener(actionListenerInNewThread(action, btn));
    ret btn;
  });
}

Author comment

Began life as a copy of #1003297

download  show line numbers  debug dex   

Travelled to 5 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pzhvpgtvlbxg, tvejysmllsmz

No comments. add comment

Snippet ID: #1022588
Snippet name: jThreadedButton - make JButton running in new thread & holding button instance
Eternal ID of this version: #1022588/1
Text MD5: 9c64810bb812aa396ed7a3610bfa541b
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-23 12:35:45
Source code size: 433 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 78 / 91
Referenced in: [show references]

Formerly at http://tinybrain.de/1022588 & http://1022588.tinybrain.de