invisibletreemodel.java

来自「tame,扩展了好多SWing组件:JTable」· Java 代码 · 共 55 行

JAVA
55
字号
/* (swing1.1) */package tame.tree;import javax.swing.tree.DefaultTreeModel;import javax.swing.tree.TreeNode;/**@author Nobuo Tamemasa@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 + =
减小字号Ctrl + -
显示快捷键?