Six buttons arranged in a 2 row x 3 column grid by GridLayout

/././././././
GridTest.java Six buttons arranged in a 2 row x 3 column grid by GridLayout.GridLayout divides the window into equal-sized rectangles based upon the number of rows and columns specified. 
******************
import java.applet.Applet;
import java.awt.*;

/** An example of GridLayout.
 *
 /./././././.

public class GridTest extends Applet {
  public void init() {
    setLayout(new GridLayout(2,3)); // 2 rows, 3 cols
    add(new Button("Button One"));
    add(new Button("Button Two"));
    add(new Button("Button Three"));
    add(new Button("Button Four"));
    add(new Button("Button Five"));
    add(new Button("Button Six"));
  }
}

Permanent link to this article: http://bangla.sitestree.com/six-buttons-arranged-in-a-2-row-x-3-column-grid-by-gridlayout/

Leave a Reply