コード例 #1
0
  /** Removes the given node from its parent. */
  public void removeNodeFromParent(MutableTreeNode node) {
    MutableTreeNode parent = (MutableTreeNode) node.getParent();

    // Ensure that the given node has a parent
    if (parent == null) {
      throw new IllegalArgumentException("node does not have a parent");
    }

    // Remove the node from the parent
    int idx = parent.getIndex(node);
    parent.remove(idx);

    // Notify listeners that the node has been removed
    fireTreeNodesRemoved(this, getPathToRoot(parent), new int[] {idx}, new Object[] {node});
  }
コード例 #2
0
ファイル: BrowserTree.java プロジェクト: colincrist/hermesjms
 public void remove(MessageStoreTreeNode node) {
   MutableTreeNode parent = (MutableTreeNode) node.getParent();
   node.close();
   parent.remove(node);
   getBrowserModel().nodeStructureChanged(parent);
 }