import java.applet.Applet;
import java.awt.*;
import javax.swing.*;

public class Fig7_12
    extends Applet
{

    public void init()
    {
	setLayout(new GridBagLayout());
	JButton buttons[] = new JButton[7];
	for (int i=0; i<buttons.length; i++)
	    buttons[i] = new JButton("Button " + i);
	GridBagConstraints gbc = new GridBagConstraints();
	// First row.
	// Add first row of buttons, all evenly spaced
	// and expanded both horizonally and vertically.
	gbc.fill = GridBagConstraints.BOTH;
	gbc.weightx = 1;
	gbc.weighty = 1;
	add(buttons[0], gbc);
	add(buttons[1], gbc);
	gbc.gridwidth = GridBagConstraints.REMAINDER;
	add(buttons[2], gbc);
	// Second row
	// One double-width button, and one double-height button
	gbc.gridwidth = 2;
	add(buttons[3], gbc);
	gbc.gridwidth = 1;
	gbc.gridheight = 2;
	add(buttons[4], gbc);
	// Third row.
	// Two single width buttons and bottom of button4.
	gbc.gridx = 0;
	gbc.gridheight = 1;
	add(buttons[5], gbc);
	gbc.gridx = 1;
	add(buttons[6], gbc);
	resize(300, 150);
    }

}


