gpt4 book ai didi

java - JXTreeTable 中可变大小的行

转载 作者:行者123 更新时间:2023-11-30 09:26:44 24 4
gpt4 key购买 nike

在 JXTreeTable 中是否可以有可变大小的行,如果是那么如何? ,我正在尝试更改 TreeExpansionEvent 上行的高度(如下所示):

public void treeExpanded(TreeExpansionEvent e)
{
for (int i = 0; i < table.getRowCount(); i++) {
System.out.println("Value of img"+table.getValueAt(i,22));

if (table.getValueAt(i, 22) != null) {
table.setRowHeight(i,40);
table.repaint();
table.revalidate();

}
}
}

在运行代码时出现以下异常:

Exception in thread "AWT-EventQueue-0" java.lang.UnsupportedOperationException: variable height rows not supported
at org.jdesktop.swingx.JXTreeTable.setRowHeight(JXTreeTable.java:1321)
at ims.View.ViewImages.treeExpanded(ViewImages.java:559)
at org.jdesktop.swingx.event.TreeExpansionBroadcaster.fireTreeExpanded(TreeExpansionBroadcaster.java:85)
at org.jdesktop.swingx.event.TreeExpansionBroadcaster.treeExpanded(TreeExpansionBroadcaster.java:68)
at javax.swing.JTree.fireTreeExpanded(JTree.java:2766)
at javax.swing.JTree.setExpandedState(JTree.java:3616)
at org.jdesktop.swingx.JXTreeTable$TreeTableCellRenderer.setExpandedState(JXTreeTable.java:2921)
at javax.swing.JTree.expandPath(JTree.java:2204)
at javax.swing.plaf.basic.BasicTreeUI.toggleExpandState(BasicTreeUI.java:2266)
at javax.swing.plaf.basic.BasicTreeUI.handleExpandControlClick(BasicTreeUI.java:2253)

请帮忙!

最佳答案

JXTreeTable 不支持可变行高。 setRowHeight() 的文档状态:

Throws UnsupportedOperationException because variable height rows are not supported.

另请参阅此 thread 中的答案@kleopatra 关于此功能。

关于java - JXTreeTable 中可变大小的行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14859809/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com