Yes ... usually you would use arithmetic expressions that use the current size of the frame to calculate a pleasing size for the spacers.
You want the spaces in your design to expand or shrink in proportion
to the size of the frame.
A fixed-sized component is inflexible.
All GUI components have a
getSize() method that
is used to determine the dimensions of the component.
The dimensions may change as a program executes, so this is a useful method.
To determine the current size of a frame, use:
Then look at the
width fields of
Use that data to create a rigid area of appropriate size.
If this is too complicated, then use glue.
The glue component is
another invisible component that class
Think of glue as stretchy caulking between components.
It keeps them separated, but expands or shrinks as needed.
To create glue use one of the following:
How is a glue component added to container such as a frame?