Im quite sure there is no difference between an applet and an aplication.
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
public class MyFrame extends JFrame implements ActionListener {
Button button = new Button("Push me!");
public MyFrame() {
super("MyFrame");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(200, 100);
button.addActionListener(this);
getContentPane().setLayout(new BorderLayout());
getContentPane().add("Center", button);
setVisible(true);
}
public final void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals(button.getActionCommand())) {
JOptionPane.showMessageDialog(this, "Hey, you pushed me!", "Button says: ", JOptionPane.PLAIN_MESSAGE);
}
}
public static void main(String[] args) {
MyFrame mf = new MyFrame();
}
}