home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-08-14 | 2.7 KB | 112 lines |
- /*---------------------------------------------------------------------------
-
- Written by the Personal Journal developers of Dow Jones & Company, Inc.
-
- Dow Jones makes no representations or warranties about
- the suitability of this software, either express or
- implied, including but not limited to the implied warranties
- of merchantability, fitness for a particular purpose,
- or non-infringement. Dow Jones will not be liable for
- any damages suffered by a user as a result of using,
- modifying or distributing this software or its derivatives.
-
-
-
- @(#)MainFrame.java 0.00 28-Dec-95
-
- A frame that handles WINDOW_DESTROY events.
-
-
- Authors:
-
- rphall Rick Hall
-
-
- Version Ident:
-
- $Header$
-
-
- History:
-
- 0.00 28-Dec-95 rphall Initial Creation
-
- ---------------------------------------------------------------------------*/
-
- package pj.awt;
-
- import java.awt.Event;
- import java.awt.Frame;
- import java.lang.String;
- import java.lang.System;
-
- /**
- * A frame that handles WINDOW_DESTROY events.
- * Typically used by applets for "standalone" operation:
- * <pre>
- * class SomeApplet extends Applet
- * {
- * // ... init, start, paint, and constructor operations
- *
- * public static void main(String args[])
- * {
- * MainFrame mf = new MainFrame("A frame title");
- * SomeApplet sa = new SomeApplet();
- * sa.init();
- * sa.start();
- * mf.add(sa);
- * mf.resize(100,100);
- * mf.show();
- * } // main
- * </pre>
- *
- * @see java.awt.Frame
- * @version 0.00 28-Dec-95
- * @author rphall
- */
- public class MainFrame extends Frame
- {
-
- // --- Public constructors
-
- /**
- * Construct a MainFrame with no title.
- */
- public MainFrame()
- {
- super();
- }
-
- /**
- * Construct a MainFrame with a title.
- * @param title The title of the frame.
- */
- public MainFrame(String title)
- {
- super(title);
- }
-
-
- // --- Public operations
-
- /**
- * Handle an event. A MainFrame will handle Event.WINDOW_DESTROY,
- * and delegate other events to its superclass, Frame.
- * @param evt An event targeted at the frame.
- * @return True if the frame handled the event, false otherwise.
- */
- public boolean handleEvent(Event evt)
- {
- if (evt.id == Event.WINDOW_DESTROY)
- {
- dispose();
- System.exit(0);
- return true;
- }
- else
- return super.handleEvent(evt);
-
- } // handleEvent
-
- }; // MainFrame
-