~cpp 
import java.awt.event.*;
import javax.swing.*;
public class Applet1 extends JApplet implements ActionListener {
	JButton button1;
	JButton button2;
	public void init() {
		
		button1 = new JButton("BUTTON1");
		button1.addActionListener(this);
		button2 = new JButton("BUTTON2");
		button2.addActionListener(this);
		JPanel panel = new JPanel();
		panel.add(button1);
		panel.add(button2);
		getContentPane().add(panel);
	}
	public void actionPerformed(ActionEvent ae) {
		if (ae.getSource() == button1) {
			JOptionPane.showMessageDialog(
				this,
				"Dialog 1",
				"1",
				JOptionPane.YES_NO_OPTION,
				null);
		} else if (ae.getSource() == button2) {
			JOptionPane.showMessageDialog(
				this,
				"Dialog 2",
				"2",
				JOptionPane.YES_NO_OPTION,
				null);
		}
	}
}