Search code examples
javaswingjgoodiesform-layout

Change FormLayout alignment at runtime


Is there a way using JGoodies FormLayout to change the alignment of a component once it has been set?

for example,

CellConstraints cc = new CellCosntraints();
panel.add(component,cc.xy(1,1,CellConstraints.DEFAULT,CellConstraints.FILL));

If I want to change component to be have a row constraint of DEFAULT instead of FILL, is there a way to change it now that it has been set without removing and re-adding the component?


Solution

  • It looks like you can:

    FormLayout l = new FormLayout();
    ...
    l.setContraints(component, newconstraints);
    

    then probably do a revalidate() on the container to update things.