在运行时更改FormLayout对齐方式

Jef*_*rey 4 java swing form-layout jgoodies

有没有办法使用JGoodies FormLayout来更改组件设置后的对齐方式?

例如,

CellConstraints cc = new CellCosntraints();
panel.add(component,cc.xy(1,1,CellConstraints.DEFAULT,CellConstraints.FILL));
Run Code Online (Sandbox Code Playgroud)

如果我想更改component为具有DEFAULT的行约束而不是FILL,是否有一种方法可以更改它,因为它已设置而不删除并重新添加组件?

Jim*_*Jim 5

看起来你可以:

FormLayout l = new FormLayout();
...
l.setContraints(component, newconstraints);
Run Code Online (Sandbox Code Playgroud)

然后可能revalidate()在容器上做一个更新的东西.