示例#1
0
文件: TreeUtil.java 项目: jexp/idea2
  public static void dropSelectionButUnderPoint(JTree tree, Point treePoint) {
    final TreePath toRetain = tree.getPathForLocation(treePoint.x, treePoint.y);
    if (toRetain == null) return;

    TreePath[] selection = tree.getSelectionModel().getSelectionPaths();
    selection = selection == null ? new TreePath[0] : selection;
    for (TreePath each : selection) {
      if (toRetain.equals(each)) continue;
      tree.getSelectionModel().removeSelectionPath(each);
    }
  }
示例#2
0
文件: TreeUtil.java 项目: jexp/idea2
 public static boolean isOverSelection(final JTree tree, final Point point) {
   TreePath path = tree.getPathForLocation(point.x, point.y);
   return path != null && tree.getSelectionModel().isPathSelected(path);
 }