FileDocCategorySizeDatePackage
JFrameDemo.javaAPI DocExample868Sat Mar 20 14:44:06 GMT 2004None

JFrameDemo

public class JFrameDemo extends JFrame
Just a Frame
version
$Id: JFrameDemo.java,v 1.13 2004/03/20 20:44:05 ian Exp $

Fields Summary
JButton
quitButton
Constructors Summary
public JFrameDemo()
Construct the object including its GUI

		super("JFrameDemo");
		Container cp = getContentPane();
		cp.add(quitButton = new JButton("Exit"));

		// Set up so that "Close" will exit the program, 
		// not just close the JFrame.
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		// This "action handler" will be explained later in the chapter.
		quitButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				setVisible(false);
				dispose();
				System.exit(0);
			}
		});
			
		pack();
	
Methods Summary
public static voidmain(java.lang.String[] args)

		new JFrameDemo().setVisible(true);