// GridLayoutDemo.java
// Demos a phone key pad using GridLayout
// APPLET CODE="GridLayoutDemo" HEIGHT=350 WIDTH=260
import java.awt.*;
import javax.swing.*;

public class GridLayoutDemo extends JApplet {
	Container c;
	JButton b[ ];
	String names[ ] = { "1", "2 ABC", "3 DEF", "4 GHI", "5 JKL", "6 MNO", "7 PRS", "8 TUV", "9 WXY", "*", "O OPER", "#" };
	GridLayout grid;

	public void init( ) {
		c = getContentPane( );
		grid = new GridLayout( 4, 3, 10, 10 );
		c.setLayout( grid );

		b = new JButton[ names.length ];
		for ( int i = 0; i < names.length; i++ ) {
			b[ i ] = new JButton( names[ i ] );
			c.add( b[ i ] );
		}

		c.setBackground( Color.black );  // background of the content pane
	}
}