Java Swing Gridlayout VERTICAL 约束
是否可以在 Gridlayout 中垂直添加组件?我的意思是下一个在上一个之上?
谢谢
Is it possible to add components in a Gridlayout verticaly ? I mean the next one above the previous one ?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不,没有任何布局允许您从下到上垂直堆叠,至少我知道。如果您想要垂直堆叠,可以使用带有单列的 GridLayout 或带有垂直轴的 BoxLayout。通过嵌套面板和组合布局,您应该可以轻松获得所需的内容,例如,具有垂直布局的面板全部放置在水平容器中。
No, there is no layout that allows you to stack vertically from the bottom up, at least that I'm aware of. If you want vertical stacking you can either use a
GridLayout
with a single column or aBoxLayout
with a vertical axis. By nesting panels and combining layouts you should easily get what you need, e.g. panels with a vertical layout all laid out in a horizontal container.像 BoxLayout 和 GridLayout 这样的布局在使用:时会从上到下显示组件,
但您始终可以使用:
在顶部插入组件。
Layouts like BoxLayout and GridLayout display components from top to bottom when you use:
but you can always use:
to insert components at the top.
虽然这个答案与网格布局无关,但我强烈建议使用 JGoodies 表单布局。其高度灵活。 http://www.jgoodies.com/freeware/forms/index.html
您可以手动编写代码以在设计的定义布局中的任何位置绘制每个组件,即针对列和行。 均匀垂直排列。
阅读白皮书:http://www.jgoodies.com/articles/forms.pdf
Though this answer is not related to Grid layout, i would highly recommend using JGoodies forms layout. Its highly flexible. http://www.jgoodies.com/freeware/forms/index.html
You can hand code to plot each component any where in the defined layout designed ie wrt to col and rows. Even vertical arrangement.
Read whitepaper: http://www.jgoodies.com/articles/forms.pdf