DialogDemoLauncher - The DialogDemoLauncher applet displays...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
/* The DialogDemoLauncher applet displays a button. When the user clicks the button, a frame is opened that demos the MessageDialog class. */ * import java.awt.*; import java.awt.event.*; import java.applet.Applet; import java.util.Date; i public class DialogDemoLauncher extends Applet implements ActionListener { p DemoFrame demo; // the main frame for the demo; this is null if the window is not open n Button launchButton; // a button for opening the window public void init() { // initialize the applet setBackground(Color.white); setLayout(new BorderLayout()); launchButton = new Button("Launch DialogDemo"); add("Center",launchButton); launchButton.addActionListener(this); } // end init(); synchronized public void actionPerformed(ActionEvent evt) { // respond to a click on the button; if no window // is open, open one; if a window is open, close it // by calling its dispose() method. if (demo == null) { demo = new DemoFrame(); launchButton.setLabel("Close DialogDemo"); demo.addWindowListener(new FrameListener()); // This object will listen for the window // event that occurs when the window closes. } else {
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/15/2010 for the course CSC 115 taught by Professor Jackson during the Spring '09 term at University of Victoria.

Page1 / 3

DialogDemoLauncher - The DialogDemoLauncher applet displays...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online