예제 #1
0
파일: TreeUtil.java 프로젝트: jexp/idea2
 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);
 }
예제 #2
0
파일: TreeUtil.java 프로젝트: jexp/idea2
 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;
   }
 }