Fillers in Box Layout
There are three kinds of fillers:
- A strut adds some space between components, e.g.:
b.add(button1) ;
b.add( Box.createHorizontalStrut(8) ) ;
b.add(button2) ;
adds 8 pixels between these buttons in a horizontal box.
- A rigid area also adds a fixed amount of space between components, but may also specify a second dimension, affecting the height of a horizontal box and the width of a vertical box e.g.:
b.add ( Box.createRigidArea( new Dimension (10, 20) ) ;
- Adding glue separates the components as much as possible, e.g.:
b.add(button1) ;
b.add( Box.createGlue( ) ) ;
b.add(button2) ;