stokastik
stokastik

Reputation: 81

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 subjects (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!

Upvotes: 3

Views: 900

Answers (1)

Guido Anselmi
Guido Anselmi

Reputation: 3912

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/

Upvotes: 2

Related Questions