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

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

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

JTree.getRowHeight介绍

暂无

代码示例

代码示例来源:origin: net.java.dev.laf-widget/laf-widget

AutoScrollingTreeDropTarget(JTree aTree, DropTargetListener listener) {
  super(aTree, DnDConstants.ACTION_COPY_OR_MOVE, listener);
  this.viewport = (JViewport) SwingUtilities.getAncestorOfClass(
      JViewport.class, aTree);
  this.scrollUnits = Math.max(aTree.getRowHeight(), 16);
  this.tree = aTree;
}

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

public void columnRemoved(TableColumnModelEvent e) {
  super.columnRemoved(e);
  if (tree.getRowHeight() <= 0)
    treeTable.invalidateAllRows();
}

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

public void columnAdded(TableColumnModelEvent e) {
  super.columnAdded(e);
  if (tree.getRowHeight() <= 0)
    treeTable.invalidateAllRows();
}

代码示例来源:origin: net.java.dev.swing-layout/swing-layout

private int getTreeBaseline(JTree tree, int height) {
  int rowHeight = tree.getRowHeight();
  if (TREE_LABEL == null) {
    TREE_LABEL = new JLabel("X");
    TREE_LABEL.setIcon(UIManager.getIcon("Tree.closedIcon"));
  }
  JLabel label = TREE_LABEL;
  label.setFont(tree.getFont());
  if (rowHeight <= 0) {
    rowHeight = label.getPreferredSize().height;
  }
  return getLabelBaseline(label, rowHeight) + tree.getInsets().top;
}

代码示例来源:origin: net.java.dev.swing-layout/swing-layout

private static int getTreeBaseline(JTree tree, int height) {
  int rowHeight = tree.getRowHeight();
  if (TREE_LABEL == null) {
    TREE_LABEL = new JLabel("X");
    TREE_LABEL.setIcon(UIManager.getIcon("Tree.closedIcon"));
  }
  JLabel label = TREE_LABEL;
  label.setFont(tree.getFont());
  if (rowHeight <= 0) {
    rowHeight = label.getPreferredSize().height;
  }
  return getLabelBaseline(label, rowHeight) + tree.getInsets().top;
}

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

/** Get a node on given point or null if there none*/
private Node getNodeForDrop(Point p) {
  if (p != null) {
    TreePath tp = tree.getPathForLocation(p.x, p.y);
    if( null == tp ) {
      //make the drop area a bit bigger at the end of the tree
      tp = tree.getPathForLocation(p.x, p.y-tree.getRowHeight()/2);
    }
    if (tp != null) {
      return DragDropUtilities.secureFindNode(tp.getLastPathComponent());
    }
  }
  return null;
}

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

/** @return The tree path to the node the cursor is above now or
* null if no such node currently exists or if conditions were not
* satisfied to continue with DnD operation.
*/
TreePath getTreePath(DropTargetDragEvent dtde, int dropAction) {
  // check location
  Point location = dtde.getLocation();
  TreePath tp = tree.getPathForLocation(location.x, location.y);
  if( null == tp ) {
    //make the drop area a bit bigger at the end of the tree
    tp = tree.getPathForLocation(location.x, location.y-tree.getRowHeight()/2);
  }
  return ((tp != null) && (DragDropUtilities.secureFindNode(tp.getLastPathComponent()) != null)) ? tp : null;
}

代码示例来源:origin: kaikramer/keystore-explorer

jtrProviders.setRowHeight(Math.max(18, jtrProviders.getRowHeight()));
jtrProviders.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
ToolTipManager.sharedInstance().registerComponent(jtrProviders);

代码示例来源:origin: kaikramer/keystore-explorer

jtrError.setRowHeight(Math.max(18, jtrError.getRowHeight()));
jtrError.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
ToolTipManager.sharedInstance().registerComponent(jtrError);

代码示例来源:origin: kaikramer/keystore-explorer

jtrProperties.setRowHeight(Math.max(18, jtrProperties.getRowHeight()));
jtrProperties.setShowsRootHandles(true);
jtrProperties.setRootVisible(false);

代码示例来源:origin: kaikramer/keystore-explorer

jtrHierarchy.setRowHeight(Math.max(18, jtrHierarchy.getRowHeight()));
jtrHierarchy.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
ToolTipManager.sharedInstance().registerComponent(jtrHierarchy);

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

if (tableColumn || tree.getRowHeight() > 0)
  return getComponentPreferredSize();

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

Rectangle bounds = getRowBounds(row);
if (c instanceof JTree) {
  int maxIconSize = bounds != null ? bounds.height : ((JTree) c).getRowHeight();
  if (_mousePosition != null) {
    c.repaint(new Rectangle(_mousePosition.x - maxIconSize, _mousePosition.y - maxIconSize, 2 * maxIconSize, 2 * maxIconSize));

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

// Create tree
JTree tree = new JTree();

// All rows will be given 15 pixels of height
tree.setRowHeight(15);

// Have the row height for each row computed individually
tree.setRowHeight(0);

// If the row height is 0 and the height of a row has dynamically changed, it is     necessary
// to flush the internal cache of row heights. The following calls flush the     internal     cache.
if (tree.getRowHeight() <= 0) {
// Temporary change to non-zero height
tree.setRowHeight(1);
}
tree.setRowHeight(0);

代码示例来源:origin: khuxtable/seaglass

largeModel = (tree.isLargeModel() && tree.getRowHeight() > 0);

相关文章

JTree类方法