FileDocCategorySizeDatePackage
JOptionDemo.javaAPI DocExample963Sat Nov 25 12:55:14 GMT 2000None

JOptionDemo

public class JOptionDemo extends JFrame
Demonstrate JOptionPane
author
Ian Darwin

Fields Summary
Constructors Summary
JOptionDemo(String s)

		super(s);

		Container cp = getContentPane();
		cp.setLayout(new FlowLayout());

		JButton b = new JButton("Give me a message");
		b.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				JOptionPane.showMessageDialog(
					JOptionDemo.this,
					"This is your message: etaoin shrdlu", "Coded Message",
					JOptionPane.INFORMATION_MESSAGE);
			}
		});
		cp.add(b);

		b = new JButton("Goodbye!");
		b.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				System.exit(0);
			}
		});
		cp.add(b);

		// the main window
		setSize(200, 150);
		pack();
	
Methods Summary
public static voidmain(java.lang.String[] arg)

		JOptionDemo x = new JOptionDemo("Testing 1 2 3...");
		x.setVisible(true);