【发布时间】:2020-04-02 02:06:56
【问题描述】:
我在 stackoverflow 上看到了另外两篇关于此的帖子,在这两个帖子中,解决方案都使用了 setConstraints(myComponent, anotherConstraint),当我尝试在 java 中使用它时,它甚至没有成为可用的方法.
want to change an Inset in a gridbag layout dynamically
Change the component weight dynamically in GridBagLayout
按下按钮后我还能如何更改组件的weightx?
实际问题是我在屏幕底部有两个组件,我需要将其中一个组件设置为按下按钮后屏幕的最大宽度。
【问题讨论】:
-
void setConstraints(Component comp, GridBagConstraints constraints) 在 GridBagLayout 的 JavaDocs 中。
标签: java swing layout-manager gridbaglayout