import java.awt.*;
import java.util.*;
import java.applet.Applet;
public class MinimalGridBag extends Applet {
    protected void makebutton(String name, 
                              GridBagLayout gridbag,
                              GridBagConstraints c) {
        Button button = new Button(name);
        gridbag.setConstraints(button, c);
        add(button);
    }
    public void init() {
        GridBagLayout gridbag = new GridBagLayout();
        GridBagConstraints c = new GridBagConstraints();
        setLayout(gridbag); 
        c.weightx = 1.0; 
        c.weighty = 1.0; 

        makebutton("Button 1", gridbag, c);

        c.fill = GridBagConstraints.BOTH; 
        makebutton("Button 2", gridbag, c);

    }
    public static void main(String args[]) {
     Frame f = new Frame("Minimal GridBag Layout Example");
     MinimalGridBag mgb = new MinimalGridBag(); 
     mgb.init();
     f.add("Center", mgb); 
     f.pack();
     f.resize(f.preferredSize());
     f.setVisible(true);
    }
} 
