FileDocCategorySizeDatePackage
GridBag2.javaAPI DocExample680Wed Aug 27 03:00:08 BST 1997None

GridBag2

public class GridBag2 extends Applet

Fields Summary
GridBagConstraints
constraints
Constructors Summary
Methods Summary
voidaddGB(java.awt.Component component, int x, int y)


	          
		constraints.gridx = x;  constraints.gridy = y;
		add ( component, constraints );
	
public voidinit()

		setLayout( new GridBagLayout() );
		constraints.weightx = 1.0;
		constraints.weighty = 1.0;
		constraints.fill = GridBagConstraints.BOTH;

		int x, y;  // for clarity
		addGB( new Button("North"),	 x=1,y=0 );
		addGB( new Button("West"), 	 x=0,y=1 );
		addGB( new Button("Center"), x=1,y=1 );
		addGB( new Button("East"), 	 x=2,y=1 );
		addGB( new Button("South"),  x=1,y=2 );