如何集成不同的布局管理器来适应这一点?
我假设我必须使用 GridLayout(1,2),并将第一面指定为 null,第二面指定为 JTextArea。
但对于左侧,我不太确定该怎么做。也许可能是 BoxLayout?
I assume I have to use a GridLayout(1,2), and assign the first side a null, and the second a JTextArea.
For the left side though, I'm not exactly sure what to do. Maybe possibly a BoxLayout?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我倾向于在 LHS 中放置一个
BorderLayout
。WEST
CENTER
或EAST
SOUTH
,放置一个带有居中FlowLayout
按钮的面板。这实际上取决于您希望在用户扩展 GUI 时如何分配额外空间。 GUI 的大小可以调整吗?
I would tend to put a
BorderLayout
in the LHS.WEST
CENTER
orEAST
SOUTH
, put a panel with a centeredFlowLayout
for the button.It really depends on how you want the extra space assigned in the event that the user expands the GUI. Is the GUI resizable?
我只需使用一个 MigLayout 即可完成。有一点学习曲线(虽然实际上不多),您将能够非常轻松地完成此类事情,并且无需嵌套布局。
I would just use a single MigLayout and be done with it. There's a little bit of learning curve (though really, not much) and you will be able to do this sort of thing very easily, and without nesting layouts.