水平扩展JTree
看起来可能有点奇怪,但是有没有办法让 JTree 的最后一个节点水平扩展而不是垂直扩展呢? 我的垂直树节点代表不同的讨论主题(政治、文化等),每个节点都有一个 Article 对象列表。我确实需要按发布日期对这些文章进行排序,并将它们水平放置在最后一个树节点中。
我希望我说得很清楚,非常感谢任何帮助或链接。谢谢你!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须重写
JTree
的paintComponent()
方法并计算绘制最后一个节点的时间。如果是的话,您将重新定位JLabel
的绘画起点,我认为它代表一片叶子。问候,
来自 Sun 的Guido
编辑
:
位于此页面: http://java.sun.com/products/jfc /tsc/文章/绘画/
You would have to override the
paintComponent()
method forJTree
and calculate when you were painting the last node. If you were, you would reposition the start point of the painting for theJLabel
which I believe represents a leaf.Regards,
Guido
Edit
From Sun:
Located on this Page: http://java.sun.com/products/jfc/tsc/articles/painting/