Horizontally expanding JTree
It may seem a little bit strange, but is there a way to make the last node of JTree expand horizontally rather than vertically? My vertical tree nodes represent different discussion sub开发者_如何学运维jects (politics, culture, etc.) and each of those nodes has a list of Article objects. I really need to sort these articles by publication date and place them in the last tree node horizontally.
I hope I was clear, any help or a link is very appreciated. Thank you!
You would have to override the paintComponent()
method for JTree
and calculate when you were painting the last node. If you were, you would reposition the start point of the painting for the JLabel
which I believe represents a leaf.
Regards,
Guido
Edit
From Sun:
Swing programs should override paintComponent().
Located on this Page: http://java.sun.com/products/jfc/tsc/articles/painting/
精彩评论