开发者

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/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜