MigLayout,禁用 JButton 宽度调整大小
我有一个类似这样的按钮布局
但问题是 Text 1 和文本 2 正在动态变化,这会破坏整个按钮布局。例如,如果 Text 2 变得比按钮调整大小要长,如下所示
如何防止这种情况发生并保持按钮宽度相同,我正在使用 MigLayout。此外,任何文本都不会太长,无法容纳在按钮内。
I have a button layout something like this
But the problem is Text 1 and Text 2 is changing dynamically which screw up the whole button layout. For example, if the Text 2 become longer than the buttons are resized soemthing like this
How can I prevent this and keep the button width same for both I am using MigLayout. Also any Text is not that much longer which can not be fit inside the button.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最有可能的是将布局设置为
MigLayout("", "[grow, fill][grow, fill]", "[]")
(将两列设置为增长和填充。)
但是,如果您以 SSCCE 身份发布,(对我们来说)测试它会更容易。
Most likely, set your layout as
MigLayout("", "[grow, fill][grow, fill]", "[]")
(Set both columns to grow and fill.)
However, if you post as SSCCE, it'll be easier (for us) to test it.