Source of Grid.java


  1: import java.awt.*;
  2: import java.applet.Applet;
  3: 
  4: public class Grid extends Applet {
  5:   public void init () {
  6:     int row = 0, col = 0; 
  7:     String att = getParameter("row");
  8:     if (att != null)
  9:       row = Integer.parseInt(att);
 10:     att = getParameter("col");
 11:     if (att != null)
 12:       col = Integer.parseInt(att);
 13:     if (row == 0 && col == 0) {
 14:       row = 3; col = 2; 
 15:     }
 16:     setLayout(new GridLayout(row, col));
 17:     add(new Button("Java"));
 18:     add(new Button("C++"));
 19:     add(new Button("Perl"));
 20:     add(new Button("Ada"));
 21:     add(new Button("Smalltalk"));
 22:     add(new Button("Eiffel"));
 23:   }
 24: }