jtable 和 intellij - 如何将列设置为显示在右侧旁边
在 intellij 上,我在 JPanel 上创建了一个 JXTable。
我添加了两列并设置了它们的宽度。
我希望面板比 jxtable 长得多,所以我将其尺寸设置得非常大。
问题是列被添加到左侧。
有没有办法让它们添加到表格区域的右侧? 我已经尝试过
jxtable.setAlignment(JComponent.RIGHT_ALIGNMENT)
但没有成功
谢谢。
On intellij I have created a JXTable on a JPanel.
I have added two columns and set their width.
I want the panel too be much longer then the jxtable and so i set its size to be very large.
The problem is that the columns are are added to the left side.
Is there a way to make them added to the right side of the table area?
I have tried
jxtable.setAlignment(JComponent.RIGHT_ALIGNMENT)
but with no success
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要使用适当的布局管理器。查看此链接:
http://download.oracle.com/javase/tutorial/uiswing/layout /visual.html
根据您的描述,将
FlowLayout
设置为RIGHT
听起来是最适合您的解决方案。You need to use an appropriate layout manager. Check out this link:
http://download.oracle.com/javase/tutorial/uiswing/layout/visual.html
From your description a
FlowLayout
set toRIGHT
sounds like the best solution for you.我可能不明白你的问题,但这是一种可以将表格放置在比表格大的面板中的方法:
I may not be understanding your question, but here is one way you can place a table in a panel that is larger than the table: