Java JTree Node isNodeAsStrChild(DefaultMutableTreeNode parent, String child)

Here you can find the source of isNodeAsStrChild(DefaultMutableTreeNode parent, String child)

Description

is Node As Str Child

License

Open Source License

Declaration

public static boolean isNodeAsStrChild(DefaultMutableTreeNode parent, String child) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import javax.swing.tree.DefaultMutableTreeNode;

public class Main {
    public static boolean isNodeAsStrChild(DefaultMutableTreeNode parent, String child) {
        for (int i = 0; i < parent.getChildCount(); i++) {
            if (((DefaultMutableTreeNode) parent.getChildAt(i)).getUserObject().toString().equals(child)) {
                return true;
            }//from   w w  w.j ava  2s.c  o  m
        }
        return false;
    }
}

Related

  1. insertNodeInAlphabeticalOrder(DefaultMutableTreeNode childNode, DefaultMutableTreeNode parentNode, DefaultTreeModel model)
  2. insertStrAsNodeLexi(DefaultTreeModel treeModel, String child, DefaultMutableTreeNode parent, Boolean childIsFile)
  3. isAncestor(final TreeNode node, final TreeNode parent)
  4. isChildNode(DefaultMutableTreeNode parent, DefaultMutableTreeNode child)
  5. isMovingUp(DefaultMutableTreeNode ntarget, DefaultMutableTreeNode nsource)
  6. isNodeOrChildSelected(JTree tree, DefaultMutableTreeNode node)
  7. isReflectanceType(TreeNode productTypeNode, String type)
  8. listTree(TreeNode node, String prefix, String lineSeparator)
  9. printTree(final DefaultMutableTreeNode tree, final String indent)