上の Applet のソースは以下のようになってます。このファイルと TabPanel.class と TabHead.class を同じディレクトリに置くだけ。(もちろん下のファイルはコンパイルします)
import java.applet.Applet;
import java.awt.*;
public class Sample1 extends Applet {
public void init() {
TabPanel tp = new TabPanel();
Label l1 = new Label("TabPanel Class");
Panel p1 = new Panel();
p1.add(l1);
Button b1 = new Button("Yoshida's home page");
Panel p2 = new Panel();
p2.add(b1);
tp.addPanel("Tab1", p1);
tp.addPanel("Tab2", p2);
add("Center", tp);
}
}
|