The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > java.awt  [78 examples] > GridBagLayout  [12 examples]

e630. 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 e622 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);

 Related Examples
e622. Creating a GridBagLayout
e623. Setting the Location of a Component in a GridBagLayout
e624. Getting the Number of Rows and Columns of Cells in a GridBagLayout
e625. Making a GridBagLayout Fill the Container
e626. Setting the Stretchyness of Rows and Columns in a GridBagLayout Using Layout Weights
e627. Setting the Stretchyness of Columns and Rows in a GridBagLayout Using Component Weights
e628. Setting the Stretchyness of a Component Within the Cell of a GridBagLayout Using Fill
e629. Setting the Location of a Component Within the Cell of a GridBagLayout Using Anchors
e631. Adjusting the Size of a Component in a GridBadLayout Using Internal Padding
e632. Setting a Row or Column of a GridBadLayout to a Particular Size
e633. Setting Gap Sizes in a GridBadLayout

See also: Colors    Components    Containers    Cursors    Drawing    Events    Focus    Frames    Images    Shapes    Simulating Events    Text    The Screen   


© 2002 Addison-Wesley.