Setting the Space around a Component Within the Cell of the GridBagLayout Using Insets
With insets, you can add space around a component.
The cell dimensions expand to accommodate this extra space.
See Creating a GridBagLayout for an example on how to
use a gridbag layout with gridbag constraints.
GridBagConstraints gbc = new GridBagConstraints();
int top = 2;
int left = 2;
int bottom = 2;
int right = 2;
gbc.insets = new Insets(top, left, bottom, right);
Post a comment