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

11
LINES

< > TinyBrain | #1021497 - treePopupMenu

JavaX fragment (include)

static <A> void treePopupMenu(final JTree tree, final VF2<JPopupMenu, A> fillMenu) {
  componentPopupMenu2(tree, voidfunc(JTree tree, JPopupMenu menu) {
    MouseEvent evt = componentPopupMenu_getEvent();
    TreePath path = tree.getPathForLocation(evt.getX(), evt.getY());
    if (path == null) ret;
    DefaultMutableTreeNode node = cast path.getLastPathComponent();
    tree.setSelectionPath(path);
    A a = cast node.getUserObject();
    callF(fillMenu, menu, a);
  });
}

download  show line numbers  debug dex   

Travelled to 3 computer(s): cfunsshuasjs, mqqgnosmbjvj, tvejysmllsmz

No comments. add comment

Snippet ID: #1021497
Snippet name: treePopupMenu
Eternal ID of this version: #1021497/3
Text MD5: d3b198cbfb0005a4bc8548aba654b95e
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-02-15 05:59:03
Source code size: 486 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 12 / 20
Version history: 2 change(s)
Referenced in: [show references]