e627. Setting the Stretchyness of Columns and Rows in a GridBagLayout Using Component Weights
See e626 Setting the Stretchyness of Rows and Columns in a GridBagLayout Using Layout Weights for an explanation of
stretchyness and weights. This example demonstrates how to set the
weight of a row or column by assigning the weight on a
component.
See e622 Creating a GridBagLayout for an example on how to
use a gridbag layout with gridbag constraints.
GridBagLayout gbl = new GridBagLayout();
container.setLayout(gbl);
// Place a component at (0,1) with a column weight 1 and
// a row weight of 2
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 1;
gbc.weightx = 1;
gbc.weighty = 2;
gbl.setConstraints(component, gbc);
container.add(component);
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
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
e630.
Setting the Space around a Component Within the Cell of the GridBagLayout Using Insets
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
© 2002 Addison-Wesley.
|