<p>I have three Java <code>JCheckboxes</code> in a column, arranged by setting the layout of the container <code>JPanel</code> to <code>GridLayout(3, 1, 1, 1)</code>.  When I run the program, there is too much vertical space between the JCheckBoxes; it looks like more than 1 pixel.  Since I've already set the vertical space between the JCheckboxes in the layout to be 1 pixel, how else can I reduce the vertical space between these JCheckboxes?</p>

<p>Thanks.</p>

I explored using
```
GridLayout
```
,
```
BorderLayout
```
, and
```
GridBagLayout
```
and I believe that any extra vertical space that is present in your application is due to the sizing of the JCheckBox component, not related to the layout manager. All of the examples below have no space between components in the layout manager.
GridLayout
```
```
//Changing to 3,1,1,0 makes slightly smaller (1 pixel) gap vertically 
GridLayout layout = new GridLayout( 3, 1, 1, 0 );
JPanel main = new JPanel( layout );
main.add( new JCheckBox( "box 1" ) );
main.add( new JCheckBox( "box 2" ) );
main.add( new JCheckBox( "box 3" ) );
```
```
GridBagLayout
```
```
GridBagConstraints gbc = new GridBagConstraints();
JPanel main = new JPanel( new GridBagLayout() );
gbc.gridx=0;
gbc.gridy=0;
gbc.ipady=0;
main.add( new JCheckBox( "box 1" ), gbc );
gbc.gridy=1;
main.add( new JCheckBox( "box 2" ), gbc );
gbc.gridy=2;
main.add( new JCheckBox( "box 3" ), gbc );
```
```
BorderLayout
```
```
JPanel main = new JPanel( new BorderLayout() );
main.add( new JCheckBox( "box 1" ), BorderLayout.NORTH );
main.add( new JCheckBox( "box 2" ), BorderLayout.CENTER );
main.add( new JCheckBox( "box 3" ), BorderLayout.SOUTH );
```
```