e1030. preventing the expansion or collapse of a node in a jtree component.txt
来自「这里面包含了一百多个JAVA源文件」· 文本 代码 · 共 19 行
TXT
19 行
The tree component's row height property controls the height of every displayed node. If the row height is greater than 0, all rows will be given the specified height. However, if the rows can be of differing heights, it is necessary to set the row height to 0. With a 0 row height, all heights of all rows are computed individually.
// 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);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?