private static boolean isDescendant(TreePath path1, final TreePath path2) {
    int count1 = path1.getPathCount();
    final int count2 = path2.getPathCount();
    if (count1 <= count2) {
      return false;
    }
    while (count1 != count2) {
      path1 = path1.getParentPath();
      count1--;
    }
    return path1.equals(path2);
  }
Helper class that provides JTree functions that are often used.
java/zylib/src/main/java/com/google/security/zynamics/zylib/gui/jtree/TreeHelpers.java