Skip to main content

JXTreeTable variable row height

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
Joined: 2012-10-01

Newbie to SwingX but have a great application for JXTreeTable. Implementation so far is good, but some of my tree node names are (very) long. Have a multi-line WordWrappingTreeCellRenderer (returns a JTextArea) that I use in JTree-based apps and was wondering if anything similar could be used in a JXTreeTable? Row height would be based on the tree cell value; other row cells just follow. Just saw a note about TableUtilities.setPreferredRowHeight(). Could this be called in the TreeCellRenderer? Or does it have to be done separately as suggested, i.e., in a TableModelListener? After the initial load? Thanks.


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-06-11

Hi welcome to SwingX :-)

individual rowHeights are not supported in JXTreeTable. I think we have a feature request in the issue tracker: it's longstanding because it's not trivail to implement due to heavy impedance mismatch between JTree (that's mis-used as renderer for the hierarchical column) and JTable row height sizing.

- JTree: either has a fixed size for all or calculates each row height dynamically (details deeply hidden in the bowels of XXLayoutCache use by the ui-delegate)
- JTable: only used fixed sizes, either the same for all rows or fixed for the individual row.

So what we might work is to allow the tree with dynamically calculated row heights to control the individual row heights of the table. But as the exact details of when/how those are re-calculated are deeply buried ... hmmm.