Download Jar. Uses 3874K of libraries. Click here for Pure Java version (2232L/15K).
1 | !7 |
2 | |
3 | import javax.swing.tree.*; |
4 | |
5 | p-substance { |
6 | DefaultMutableTreeNode rootNode = new("root"); |
7 | rootNode.add(new DefaultMutableTreeNode("dummy")); |
8 | final JTree tree = new JTree(rootNode); |
9 | tree.setShowsRootHandles(true); |
10 | tree.collapseRow(0); |
11 | |
12 | tree.addTreeWillExpandListener(new TreeWillExpandListener { |
13 | public void treeWillCollapse(TreeExpansionEvent e) {} |
14 | public void treeWillExpand(TreeExpansionEvent e) throws ExpandVetoException { |
15 | DefaultMutableTreeNode node = cast e.getPath().getLastPathComponent(); |
16 | print("treeWillExpand, node=" + node.getUserObject()); |
17 | node.removeAllChildren(); |
18 | node.add(new DefaultMutableTreeNode(str(now()))); |
19 | ((DefaultTreeModel) tree.getModel()).nodeStructureChanged(node); |
20 | } |
21 | }); |
22 | |
23 | showFrame(jscroll(tree)); |
24 | } |
Began life as a copy of #1008646
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1008647 |
Snippet name: | JTree with children made on demand [WORKS] |
Eternal ID of this version: | #1008647/18 |
Text MD5: | 6f9e981f3d1102dcf62341e906d79bed |
Transpilation MD5: | 64b1a34ee8bc2fbea3b5890623c0ad18 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-05-26 18:03:58 |
Source code size: | 816 bytes / 24 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 735 / 1351 |
Version history: | 17 change(s) |
Referenced in: | [show references] |