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

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

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

JTree.getLeadSelectionPath介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-beans

@Override
  public void actionPerformed(ActionEvent actionEvent) {
    TreePath treePath = myJavaHierarchyTree.getLeadSelectionPath();
    if (treePath != null) {
      Object node = treePath.getLastPathComponent();
      if (node instanceof JavaElement) {
        gotoElement((JavaElement) node);
      }
    }
  }
},

代码示例来源:origin: UNIVALI-LITE/Portugol-Studio

@Override
  public void paint(Graphics g, JComponent c) {
    JTree tree = (JTree) c;
    
    if(tree.isOpaque()){
      g.setColor(tree.getBackground());
      g.fillRect(0, 0, tree.getWidth(), tree.getHeight());
    }
    if (tree.getSelectionCount() > 0) {
      g.setColor(ColorController.COR_DESTAQUE);
      //@see http://ateraimemo.com/Swing/TreeRowSelection.html
      for (int i : tree.getSelectionRows()) {
        Rectangle r = tree.getRowBounds(i);
        g.fillRect(0, r.y, tree.getWidth(), r.height);
      }
    }
    super.paint(g, c);
    
    if (tree.getLeadSelectionPath() != null) {
      Rectangle r = tree.getRowBounds(getRowForPath(tree, tree.getLeadSelectionPath()));
      g.setColor(tree.hasFocus() ? ColorController.FUNDO_MEDIO.brighter(): ColorController.FUNDO_MEDIO);
//            g.drawRect(0, r.y, tree.getWidth() - 1, r.height - 1);
    }
  }

代码示例来源:origin: com.jidesoft/jide-oss

return tree.convertValueToText(treeNode, selected, tree.isExpanded((TreePath) object), tree.getModel().isLeaf(treeNode), tree.getRowForPath((TreePath) object), tree.hasFocus() && tree.getLeadSelectionPath() == object);

代码示例来源:origin: stackoverflow.com

if (getLeadSelectionPath() != null) {
 Rectangle r = getRowBounds(getRowForPath(getLeadSelectionPath()));
 g.setColor(hasFocus() ? SELC.darker() : SELC);
 g.drawRect(r.x, r.y, getWidth() - r.x - 1, r.height - 1);
if (getLeadSelectionPath() != null) {
 Rectangle r = getRowBounds(getRowForPath(getLeadSelectionPath()));
 g.setColor(hasFocus() ? SELC.darker() : SELC);
 g.drawRect(0, r.y, getWidth() - 1, r.height - 1);

代码示例来源:origin: de.sciss/jtreetable

private void repaintLead() {
  TreePath lead = tree.getLeadSelectionPath();
  if (lead == null)
    return;
  int row = tree.getRowForPath(lead);
  Rectangle rect;
  if (treeTable.isColumnFocusEnabled()) {
    int col = table.getColumnModel().getSelectionModel().getLeadSelectionIndex();
    if (col < 0)
      return;
    rect = table.getCellRect(row, col, true);
  } else {
    rect = table.getCellRect(row, 0, true);
    rect.width = treeTable.getWidth();
  }
  treeTable.repaint(rect);
}

代码示例来源:origin: org.java.net.substance/substance

TreePath leadPath = this.tree.getLeadSelectionPath();
  leadIndex = this.getRowForPath(this.tree, leadPath);
} else {

代码示例来源:origin: com.github.insubstantial/substance

TreePath leadPath = this.tree.getLeadSelectionPath();
  leadIndex = this.getRowForPath(this.tree, leadPath);
} else {

代码示例来源:origin: de.sciss/jtreetable

int row = tree.getRowForPath(tree.getLeadSelectionPath());
int columns = table.getColumnModel().getColumnCount();
if (row >= 0 && columns > 0) {

相关文章

JTree类方法