PreviewDialog.java 文件源码

java
阅读 20 收藏 0 点赞 0 评论 0

项目:oxygen-dita-translation-package-builder 作者:
/**
 * Returns the index of a child of a given node, provided its string value.
 * 
 * @param node The node to search its children.
 * @param childValue The value of the child to compare with.
 * @return The index.
 */
private int childIndex(final DefaultMutableTreeNode node, final String childValue) {
  @SuppressWarnings("unchecked")
  Enumeration<DefaultMutableTreeNode> children = node.children();
  DefaultMutableTreeNode child = null;
  int index = -1;

  while (children.hasMoreElements() && index < 0) {
    child = children.nextElement();

    if (child.getUserObject() != null && childValue.equals(child.getUserObject())) {
      index = node.getIndex(child);
    }
  }

  return index;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号