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

11
LINES

< > BotCompany Repo | #1021480 // treeDependButton

JavaX fragment (include)

static <A extends JButton> A treeDependButton(final JTree tree, final A b) {
  if (b != null) swing {
    tree.addTreeSelectionListener(new TreeSelectionListener {
      public void valueChanged(TreeSelectionEvent e) {
        b.setEnabled(getSelectedTreeNode(tree) != null);
      }
    });
    b.setEnabled(getSelectedTreeNode(tree) != null);
  }
  ret b;
}

Author comment

Began life as a copy of #1004936

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1021480
Snippet name: treeDependButton
Eternal ID of this version: #1021480/4
Text MD5: 05974b17deb7205b1a699b07fc344080
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-02-14 17:01:01
Source code size: 369 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 325 / 342
Version history: 3 change(s)
Referenced in: [show references]