FileDocCategorySizeDatePackage
ButtonDemo2a.javaAPI DocExample610Sun Mar 11 21:28:34 GMT 2001None

ButtonDemo2a

public class ButtonDemo2a extends Applet implements ActionListener
Demonstrate use of two buttons, using a single ActionListener, being the class itself.

Fields Summary
Button
b1
Button
b2
Constructors Summary
Methods Summary
public voidactionPerformed(java.awt.event.ActionEvent e)

		if (e.getSource() == b1)
			showStatus("Thanks for pushing my first button!");
		else
			showStatus("Thanks for pushing my second button!");
	
public voidinit()

		add(b1 = new Button("A button"));
		b1.addActionListener(this);

		add(b2 = new Button("Another button"));
		b2.addActionListener(this);