home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.Button;
- import java.awt.CardLayout;
- import java.awt.Container;
- import java.awt.Event;
- import java.awt.List;
- import java.awt.Panel;
- import java.awt.TextField;
-
- public class CardApplet2 extends Applet {
- CardLayout cardLayout;
- Panel panel;
- Panel card1;
- Panel card2;
- Panel card3;
- Button button1;
- Button button2;
- Button button3;
- List list;
- TextField textField;
-
- public void init() {
- this.panel = new Panel();
- ((Container)this).add(this.panel);
- this.card1 = new Panel();
- this.card2 = new Panel();
- this.card3 = new Panel();
- this.cardLayout = new CardLayout(0, 0);
- this.panel.setLayout(this.cardLayout);
- this.panel.add("Card1", this.card1);
- this.panel.add("Card2", this.card2);
- this.panel.add("Card3", this.card3);
- this.button1 = new Button("Button1");
- this.button2 = new Button("Button2");
- this.button3 = new Button("Button3");
- this.card1.add("Button1", this.button1);
- this.card1.add("Button2", this.button2);
- this.card1.add("Button3", this.button3);
- this.list = new List(10, false);
- this.list.addItem("Scrolling list");
- this.card2.add("List", this.list);
- this.textField = new TextField("", 30);
- this.card3.add("TextField", this.textField);
- ((Applet)this).resize(250, 250);
- }
-
- public boolean action(Event var1, Object var2) {
- this.cardLayout.next(this.panel);
- return true;
- }
- }
-