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

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

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

JTree.getRowCount介绍

暂无

代码示例

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

@Override
public int getRowCount() {
  return tree.getRowCount();
}

代码示例来源:origin: deathmarine/Luyten

public void restoreExpanstionState(Set<String> expansionState) {
  if (tree != null && expansionState != null) {
    // tree.getRowCount() changes at tree.expandRow()
    for (int i = 0; i < tree.getRowCount(); i++) {
      TreePath path = tree.getPathForRow(i);
      if (expansionState.contains(getRowPathStr(path))) {
        tree.expandRow(i);
      }
    }
  }
}

代码示例来源:origin: deathmarine/Luyten

public Set<String> getExpansionState() {
  Set<String> openedSet = new HashSet<>();
  if (tree != null) {
    int rowCount = tree.getRowCount();
    for (int i = 0; i < rowCount; i++) {
      TreePath path = tree.getPathForRow(i);
      if (tree.isExpanded(path)) {
        String rowPathStr = getRowPathStr(path);
        // for switching Package Explorer on/off
        openedSet.addAll(getAllParentPathsStr(rowPathStr));
      }
    }
  }
  return openedSet;
}

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

for (int ii = tree.getRowCount(); ii>-1; ii--) {
  tree.expandRow(ii);

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

for (int ii=0; ii<tree.getRowCount(); ii++) {
  tree.expandRow(ii);

代码示例来源:origin: jshiell/checkstyle-idea

/**
 * Collapse the tree so that only the root node is visible.
 */
public void collapseTree() {
  for (int i = 1; i < resultsTree.getRowCount(); ++i) {
    resultsTree.collapseRow(i);
  }
}

代码示例来源:origin: camunda/camunda-bpm-platform

protected void collapseTree() {
 // collapse everything except the first category
 CategoryExplorerTree tree = _monitor.getCategoryExplorerTree();
 for (int i = tree.getRowCount() - 1; i > 0; i--) {
  tree.collapseRow(i);
 }
}

代码示例来源:origin: knowm/XChart

protected void init() {
 // Create the nodes.
 DefaultMutableTreeNode top = new DefaultMutableTreeNode("XChart Example Charts");
 createNodes(top);
 tree = new JTree(top);
 // Create a tree that allows one selection at a time.
 tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
 // Listen for when the selection changes.
 tree.addTreeSelectionListener(this);
 // Create the scroll pane and add the tree to it.
 JScrollPane treeView = new JScrollPane(tree);
 // Create Chart Panel
 tabbedPane = new JTabbedPane();
 for (int i = 0; i < tree.getRowCount(); i++) {
  tree.expandRow(i);
 }
 // select first leaf
 DefaultMutableTreeNode firstLeaf = top.getFirstLeaf();
 tree.setSelectionPath(new TreePath(firstLeaf.getPath()));
 // Add the scroll panes to a split pane.
 splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
 splitPane.setTopComponent(treeView);
 splitPane.setBottomComponent(tabbedPane);
 Dimension minimumSize = new Dimension(130, 160);
 treeView.setMinimumSize(minimumSize);
 splitPane.setPreferredSize(new Dimension(700, 700));
 // Add the split pane to this panel.
 add(splitPane);
}

代码示例来源:origin: org.cytoscape/swing-util-api

/**
 *  Returns the number of rows in the {@link JTree}.
 *
 * @return  The int number of rows in the JTree.
 */
public int getRowCount() {
  return tree.getRowCount();
}

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

private void expandAllNodes(JTree tree, int startingIndex, int rowCount){
  for(int i=startingIndex;i<rowCount;++i){
    tree.expandRow(i);
  }

  if(tree.getRowCount()!=rowCount){
    expandAllNodes(tree, rowCount, tree.getRowCount());
  }
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

void expandAll( int startingIndex, int rowCount )
{
 for( int i = startingIndex; i < rowCount; ++i )
 {
  _tree.expandRow( i );
 }
 if( _tree.getRowCount() != rowCount )
 {
  expandAll( rowCount, _tree.getRowCount() );
 }
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

@SuppressWarnings("UnusedDeclaration")
public void expandAll()
{
 expandAll( 0, _tree.getRowCount() );
}
void expandAll( int startingIndex, int rowCount )

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

void expandAll( int startingIndex, int rowCount )
{
 for( int i = startingIndex; i < rowCount; ++i )
 {
  _tree.expandRow( i );
 }
 if( _tree.getRowCount() != rowCount )
 {
  expandAll( rowCount, _tree.getRowCount() );
 }
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-lab

void expandAll( int startingIndex, int rowCount )
{
 for( int i = startingIndex; i < rowCount; ++i )
 {
  _tree.expandRow( i );
 }
 if( _tree.getRowCount() != rowCount )
 {
  expandAll( rowCount, _tree.getRowCount() );
 }
}

代码示例来源:origin: org.orbisgis/toc

/**
   * Expand configuration tree
   *
   * @param tree The tree we want to process.
   */
  private void expandAll(JTree tree) {
    for (int row = 0; row < tree.getRowCount(); row++) {
      tree.expandRow(row);
    }
  }
}

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

public void actionPerformed(ActionEvent e) {
   for (int i = 1; i < tree.getRowCount(); i++) {
    if (cbExp.isSelected()) {
     tree.expandRow(i);
    }
    else {
     tree.collapseRow(i);
    }
   }
  }
}

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

@Override
protected int getElementCount() {
  if (!isRecursive()) {
    return ((JTree) _component).getRowCount();
  }
  else {
    return getTreePathes().size();
  }
}

代码示例来源:origin: igniterealtime/Spark

private void selectVeryFirstLeaf() {
  if (historyTree == null || historyTree.getRowCount() < 1)
    return;
  historyTree.expandRow(1);
  DefaultMutableTreeNode firstLeaf = ((DefaultMutableTreeNode) historyTree
      .getModel().getRoot()).getFirstLeaf();
  TreePath path = new TreePath(firstLeaf.getPath());
  historyTree.setSelectionPath(path);
}

代码示例来源:origin: org.biojava.thirdparty/forester

void writeAll() {
    for( int i = 0; i < getJTree().getRowCount(); i++ ) {
      final TreePath p = getJTree().getPathForRow( i );
      writeBack( ( DefaultMutableTreeNode ) p.getLastPathComponent() );
    }
  }
}

代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core

/**
 * Returns the treePath for the row or null if invalid.
 * 
 */
public TreePath getTreePath() {
  if (getComponent() == null) return null;
  if ((row < 0) || (row >= getComponent().getRowCount())) return null;
  return getComponent().getPathForRow(row);
}
/**

相关文章

JTree类方法