Button b;
GridBagLayout gb = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
setLayout(gb);
try {
/* Row One - Three button */
b = new Button ("One");
addComponent (this, b, 0, 0, 1, 1,
GridBagConstraints.BOTH, GridBagConstraints.CENTER);
b = new Button ("Two");
addComponent (this, b, 1, 0, 1, 1,
GridBagConstraints.BOTH, GridBagConstraints.CENTER);
b = new Button ("Three");
addComponent (this, b, 2, 0, 1, 1,
GridBagConstraints.BOTH, GridBagConstraints.CENTER);
/* Row Two - Two buttons */
b = new Button ("Four");
addComponent (this, b, 0, 1, 2, 1,
GridBagConstraints.BOTH, GridBagConstraints.CENTER);
b = new Button ("Five");
addComponent (this, b, 2, 1, 1, 2,
GridBagConstraints.BOTH, GridBagConstraints.CENTER);
/* Row Three - Two buttons */
b = new Button ("Six");
addComponent (this, b, 0, 2, 1, 1,
GridBagConstraints.BOTH, GridBagConstraints.CENTER);
b = new Button ("Seven");
addComponent (this, b, 1, 2, 1, 1,
GridBagConstraints.BOTH, GridBagConstraints.CENTER);
} catch (Exception e) {
e.printStackTrace();
}