// File:  TwoButtons\TwoButtons.java

// Display two AWT buttons; use inner classes for handlers

import java.awt.*;
import java.awt.event.*;
import java.applet.*;

public class TwoButtons extends Applet {

    /**
     *  Create the two buttons, btn1 and btn2; load their labels
     */
    private Button btn1 = new Button("Btn 1"),
                   btn2 = new Button("Btn 2");

    /**
     *  Associate button handler ButtonHandler1 with button btn1;
     *  associate button handler ButtonHandler2 with button btn2;
     *  add both buttons to the screen
     */
    public void init() {
        btn1.addActionListener(new ButtonHandler1());
        btn2.addActionListener(new ButtonHandler2());
        add(btn1);
        add(btn2);
    }

    /**
     *  Button handlers for buttons 1 and 2
     */
    class ButtonHandler1 implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            showStatus("BUTN-1");
        }
    }

    class ButtonHandler2 implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            showStatus("BUTN-2");
        }
     }

}  // end of class TwoButtons
