Is there an easy way to get all (or most) of the components in a GroupLayout application NOT to stretch vertically? I know I can do this by forcing each component to use its preferred size when I add it, but this makes the code much more verbose:
.addGroup(layout.createSequentialGroup()
.addComponent(oDevRadio)
.addComponent(oInstRadio)
)
becomes
.addGroup(layout.createSequentialGroup()
.addComponent(oDevRadio,
GroupLayout.PREFERRED_SIZE,
GroupLayout.PREFERRED_SIZE,
GroupLayout.PREFERRED_SIZE)
.addComponent(oInstRadio,
GroupLayout.PREFERRED_SIZE,
GroupLayout.PREFERRED_SIZE,
GroupLayout.PREFERRED_SIZE)
)
Is there a way to set it as the default and just specify the elements that I want to stretch?
Links
- addComponent specification
source
share