📄 invisibletreemodel.java
字号:
/* (swing1.1) */ package jp.gr.java_conf.tame.swing.tree;import javax.swing.tree.*;/** * @version 1.0 01/12/99 */public class InvisibleTreeModel extends DefaultTreeModel { protected boolean filterIsActive; public InvisibleTreeModel(TreeNode root) { this(root, false); } public InvisibleTreeModel(TreeNode root, boolean asksAllowsChildren) { this(root, false, false); } public InvisibleTreeModel(TreeNode root, boolean asksAllowsChildren ,boolean filterIsActive) { super(root, asksAllowsChildren); this.filterIsActive = filterIsActive; } public void activateFilter(boolean newValue) { filterIsActive = newValue; } public boolean isActivatedFilter() { return filterIsActive; } public Object getChild(Object parent, int index) { if (filterIsActive) { if (parent instanceof InvisibleNode) { return ((InvisibleNode)parent).getChildAt(index,filterIsActive); } } return ((TreeNode)parent).getChildAt(index); } public int getChildCount(Object parent) { if (filterIsActive) { if (parent instanceof InvisibleNode) { return ((InvisibleNode)parent).getChildCount(filterIsActive); } } return ((TreeNode)parent).getChildCount(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -