FileDocCategorySizeDatePackage
Grid.javaAPI DocExample792Sun Mar 01 23:03:50 GMT 1998None

Grid.java

// File:  Grid.java
// T Balls
// Mar 1998
// Demo of GridLayout

import java.awt.*;

public class Grid extends Frame
{  public Grid()
   {  setTitle( "Grid" );
      setSize( 100, 150 );
      setLayout( new GridLayout( 3, 2 ) );
      add( new Button( "1" ) );
      add( new Button( "TWO" ) );
      add( new Button( "3" ) );
      
      Button b4 = new Button( "four" );
      b4.setBackground( Color.blue );
      b4.setForeground( Color.white );
      add( b4 );

      Button b5 = new Button( "5" );
      b5.setFont( new Font( "Monospaced", Font.BOLD, 20 ) );
      add( b5 );

      Button b6 = new Button( "-6-" );
      b6.setForeground( Color.yellow );
      add( b6 );
      
      setVisible( true );
   }

   public static void main( String[] args )
   {  new Grid();
   }
}