import java.awt.*;
import java.awt.event.*;
public class CycleCards extends java.applet.Applet implements ActionListener {
CardLayout cards = new CardLayout();
public void init() {
setLayout( cards );
Button button;
button = new Button("Component One");
button.addActionListener( this );
add( "One", button );
button = new Button("Component Two");
button.addActionListener( this );
add( "Two", button );
button = new Button("Component Three");
button.addActionListener( this );
add( "Three", button );
cards.show(this, "Two");
}
public void actionPerformed( ActionEvent e ) {
cards.next( this );
}
}
|