import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

        // Display a Message Dialog when a button is pressed.
class SwingOptionFrame1 extends JFrame {
    public SwingOptionFrame1() {
        final int width = 300, height = 100;
        setSize(width,height);
        final Container contents = getContentPane();

        // A button to trigger the message.
        JButton advice = new JButton("Advice");
        advice.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e){
                JOptionPane.showMessageDialog(
                        contents,
                        "Don't go out without an umbrella.",
                        "Helpful Advice",
                        JOptionPane.INFORMATION_MESSAGE);
            }
        });

        // A panel to hold the buttons in the frame.
        JPanel panel = new JPanel();
        panel.add(advice);
        panel.add(new QuitJButton());
        contents.add(panel,"South");
    }
}
