import java.applet.*; import java.awt.*; // The Lesson4 illustrates defining your own class. // It also shows the use of Layout Managers. public class Lesson4 extends Applet { public void init() { setLayout(new BorderLayout()); // create a MyPanel object and place on left side MyPanel p1 = new MyPanel(); add("West", p1); } } class MyPanel extends Panel { // Class Constructor is used when objects are first created MyPanel() { // Layout buttons in a grid with 4 rows and 1 column setLayout(new GridLayout(4,1)); add(new Button("1")); add(new Button("2")); add(new Button("3")); add(new Button("4")); } }