# GUI Builder: GridBag Customizer

Use to visually adjust the placement and constraints of components in a GridBagLayout. It includes a property sheet for GridBag constraints, buttons for adjusting the constraints, and a rough depiction of the layout of the components.

The GridBag customizer enables you to adjust the following constraints:

Element | Description
--- | ---
Grid X and Grid Y | Fine-tune the component's horizontal and vertical position if necessary by setting its X and Y grid positions.
Grid Width and Grid Height | Set Grid Width and Grid Height to specify how many grid positions are allocated for the component in each direction. Specify either: An integer value - the number of cells the component uses, (not the number of pixels) Remainder - to make the component the last one in its row or column, using all remaining horizontal or vertical space Relative - to specify that the component be the next to last one in its row or column You can also adjust Grid Width and Height using the Grid Size buttons. Click the rightmost button with yellow shading to set the value to Remainder.
Fill | The Fill constraint enables you to choose whether the component uses all of the vertical or horizontal space (or both) that is allocated to it. Any space allocated to a component that the component does not fill is marked with blue in the right pane.
Internal Padding X and Y | The internal padding settings enable you to increase the horizontal and vertical dimensions of the component. You can adjust these by directly entering numbers for the properties or by using the I-Padding buttons.
Anchor | The Anchor constraint enables you to place the component in one of nine positions within the space allocated to it (Center, North, North-West, and so on). This setting has no effect if there is no free space remaining for the component.
Weight X and Weight Y | Adjust the weight settings to determine how much space a component should be given relative to other components in its row or column when the container window is resized. Generally, weight values range from zero to one. Components with larger weight values get more space allocated in their row or column when the window is resized.Components with a weight value of zero always retain their preferred size for that dimension. If all the components in a row or column have a weight of zero, any extra space goes to the outer edges of the row or column and the components stay the same size.
Insets | The Insets determine the minimum amount of external space on each of the four sides of the component. You can enter numbers manually or use the inset buttons. The buttons are divided into four sets that enable you to adjust the insets for each side separately, the left and right insets simultaneously, the top and bottom insets simultaneously, or all four insets simultaneously. As you change the insets, you will see the inset area marked by a yellow background in the right pane.

Related Topics

Developing Applications with NetBeans IDE,

Copyright © 2016, Oracle and/or its affiliates. All rights reserved.