Search

Card Demo Example - Applet

import java.awt.*;
import java.applet.*;
import java.awt.event.*;

/*<applet code="CardDemo.class" width=400 height=300>
</applet>*/
public class   CardDemo extends Applet implements ActionListener
{
CardLayout cl;
Button b1,b2,b3,b4;
  public void init()
{
cl  =new CardLayout();
   setLayout(cl);
   b1=new Button("one");
   b2=new Button("two");
   b3=new Button("three");
   b4=new Button("Four");

   add("first",b1);
   add("second",b2);
   add("third",b3);
   add("four",b4);
  b1. addActionListener(this);
    b2. addActionListener(this);
  b3. addActionListener(this);
  b4. addActionListener(this);

}

public void actionPerformed(ActionEvent ae)
{
cl.next(this);
}
}



No comments:

Post a Comment