javax.swing.JTree.isSelectionEmpty()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中javax.swing.JTree.isSelectionEmpty()方法的一些代码示例,展示了JTree.isSelectionEmpty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTree.isSelectionEmpty()方法的具体详情如下:
包路径:javax.swing.JTree
类名称:JTree
方法名:isSelectionEmpty

JTree.isSelectionEmpty介绍

暂无

代码示例

代码示例来源:origin: bcdev/beam

OpendapLeaf getSelectedLeaf() {
  if (jTree.isSelectionEmpty()) {
    return null;
  }
  DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) jTree.getAnchorSelectionPath().getLastPathComponent();
  return (OpendapLeaf) selectedNode.getUserObject();
}

代码示例来源:origin: org.zaproxy/zap

private SiteNode getSiteTreeTarget() {
    if (!extension.getView().getSiteTreePanel().getTreeSite().isSelectionEmpty()) {
      return (SiteNode) extension.getView().getSiteTreePanel().getTreeSite().getSelectionPath()
          .getLastPathComponent();
    }
    return null;
  }
}

代码示例来源:origin: jpcsp/jpcsp

/** Configures a tree cell renderer and sets up sizing and the
 * backing image from it */
public boolean configure (Object nd, JScrollPane tv, JTree tree, TreePath path, int row) {
  setLastRendereredObject(nd);
  setLastRenderedScrollPane (tv);
  Component renderer = null;
  bg = tree.getBackground();
  boolean sel = tree.isSelectionEmpty() ? false :
    tree.getSelectionModel().isPathSelected(path);
  boolean exp = tree.isExpanded(path);
  boolean leaf = !exp && tree.getModel().isLeaf(nd);
  boolean lead = path.equals(tree.getSelectionModel().getLeadSelectionPath());
  renderer = tree.getCellRenderer().getTreeCellRendererComponent(tree, nd, sel, exp, leaf, row, lead);
  if (renderer != null) {
    setComponent (renderer);
  }
  return true;
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

/** Configures a tree cell renderer and sets up sizing and the 
 * backing image from it */
public boolean configure (Object nd, JScrollPane tv, JTree tree, TreePath path, int row) {
  boolean sameVn = setLastRendereredObject(nd);
  boolean sameComp = setLastRenderedScrollPane (tv);
  Component renderer = null;
  bg = tree.getBackground();
  boolean sel = tree.isSelectionEmpty() ? false :
    tree.getSelectionModel().isPathSelected(path);
  boolean exp = tree.isExpanded(path);
  boolean leaf = !exp && tree.getModel().isLeaf(nd);
  boolean lead = path.equals(tree.getSelectionModel().getLeadSelectionPath());
  renderer = tree.getCellRenderer().getTreeCellRendererComponent(tree, nd, sel, exp, leaf, row, lead);
  if (renderer != null) {
    setComponent (renderer);
  }
  return true;
}

相关文章

JTree类方法