有没有一种方法可以使用 JGoodies FormLayout 在设置组件后更改其对齐方式?
例如,
CellConstraints cc = new CellCosntraints();
panel.add(component,cc.xy(1,1,CellConstraints.DEFAULT,CellConstraints.FILL));
如果我想将 component
更改为具有 DEFAULT 而不是 FILL 的行约束,现在是否可以更改它,因为它已经设置好而无需删除和重新添加组件?
最佳答案
看起来你可以:
FormLayout l = new FormLayout();
...
l.setContraints(component, newconstraints);
然后可能在容器上执行 revalidate()
以更新内容。
关于java - 在运行时更改 FormLayout 对齐方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9571506/