2006-07-28 18:09:42 UTC
import java.awt.*;
import java.awt.event.*;
/** Demo of the JTablePane component. **/
public class TabbedApplet extends JApplet
{
public void init () {
Container content_pane = getContentPane ();
// Create an instance of our Tabs class.
Tabs tabs = new Tabs (this);
// And add it to the applet's panel.
content_pane.add (tabs);
} // init
} // class TabbedApplet
/** This JTabbedPane subclass holds three panes, each
* with one button.
**/
class Tabs extends JTabbedPane
implements ActionListener {
JApplet fApplet;
/** Put a button on each of three pages. **/
Tabs (JApplet applet) {
fApplet = applet;
add (makeButton ("1"), "One" );
add (makeButton ("2"), "Two" );
add (makeButton ("3"), "Three" );
} // ctor
/** Make a button here and add this object
* to its action listeners list.
**/
JButton makeButton ( String name) {
JButton b = new JButton ( name );
b.addActionListener ( this );