FileDocCategorySizeDatePackage
ButtonDemoApplet.javaAPI DocExample1275Tue Dec 12 18:58:50 GMT 2000None

ButtonDemoApplet

public class ButtonDemoApplet extends Applet implements ActionListener

Fields Summary
protected Button
b1
protected Button
b2
protected Button
b3
protected static final String
DISABLE
protected static final String
ENABLE
Constructors Summary
Methods Summary
public voidactionPerformed(java.awt.event.ActionEvent e)

        if (e.getActionCommand().equals(DISABLE)) {
            b2.setEnabled(false);
            b1.setEnabled(false);
            b3.setEnabled(true);
        } else {
            b2.setEnabled(true);
            b1.setEnabled(true);
            b3.setEnabled(false);
        }
    
public voidinit()


       
        b1 = new Button();
        b1.setLabel("Disable middle button");
        b1.setActionCommand(DISABLE);

        b2 = new Button("Middle button");

        b3 = new Button("Enable middle button");
        b3.setEnabled(false);
        b3.setActionCommand(ENABLE);

        //Listen for actions on buttons 1 and 3.
        b1.addActionListener(this);
        b3.addActionListener(this);

        //Add Components to the Applet, using the default FlowLayout. 
        add(b1);
        add(b2);
        add(b3);