Button2New.java


</COMMENT> No Java 2 support for APPLET!!

//: c13:Button2New.java
// Capturing button presses.
// <applet code=Button2New 
// width=200 height=50> </applet>
import javax.swing.*;
import java.awt.*;
import java.awt.event.*; // Must add this

public class Button2New extends JApplet {
  JButton
    b1 = new JButton("Button 1"),
    b2 = new JButton("Button 2");
  public void init() {
    b1.addActionListener(new B1());
    b2.addActionListener(new B2());
    Container cp = getContentPane();
    cp.setLayout(new FlowLayout());
    cp.add(b1);
    cp.add(b2);
  }
  class B1 implements ActionListener {
    public void actionPerformed(ActionEvent e) {
      getAppletContext().showStatus("Button 1");
    }
  }
  class B2 implements ActionListener {
    public void actionPerformed(ActionEvent e) {
      getAppletContext().showStatus("Button 2");
    }
  }
} ///:~