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

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.