public static ActionCallback selectFirstNode(final JTree tree) { final TreeModel model = tree.getModel(); final Object root = model.getRoot(); TreePath selectionPath = new TreePath(root); if (!tree.isRootVisible() && model.getChildCount(root) > 0) selectionPath = selectionPath.pathByAddingChild(model.getChild(root, 0)); return selectPath(tree, selectionPath); }
public static int getDepthOffset(JTree aTree) { if (aTree.isRootVisible()) { if (aTree.getShowsRootHandles()) { return 1; } else { return 0; } } else if (!aTree.getShowsRootHandles()) { return -1; } else { return 0; } }