import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class HelloClosuresApplet extends JApplet { public void init() { JButton button = new JButton("Press Me"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { JOptionPane.showMessageDialog(null, "Hello Closures"); } }); this.getContentPane().add(button); } }