How to define the horizontal layout of DefaultTreeCellRenderer.

Answered

In the screenshot below, I created a SimpleColoredComponent object in getTreeCellRendererComponent and appended three text segments. Can I right-align the last segment of the text (the author)

0
3 comments

Hi,

It seems the screenshot is missing.

0

Sorry, I just uploaded screenshot

0

Hi,

I don't think it is doable or makes sense with Tree. I don't see any similar examples in the platform code, and the only idea is to calculate the margin and render elements with this margin. It is a bad idea because you would have to visit each tree element and calculate the max margin.

I would try using the TreeTable component instead and render the author in a separate column.

0

Please sign in to leave a comment.