home *** CD-ROM | disk | FTP | other *** search
/ Dynamic HTML in Action / Dynamicke-HTML-v-akci-covermount.bin / XML / PARSER / XMLINST.EXE / viewer / XMLViewerFrame.java < prev   
Encoding:
Java Source  |  1997-10-24  |  1.9 KB  |  63 lines

  1. //******************************************************************************
  2. // XMLViewerFrame.java:    
  3. //
  4. //******************************************************************************
  5. import java.awt.*;
  6. import java.applet.*;
  7.  
  8. //==============================================================================
  9. // STANDALONE APPLICATION SUPPORT
  10. //     This frame class acts as a top-level window in which the applet appears
  11. // when it's run as a standalone application.
  12. //==============================================================================
  13. class XMLViewerFrame extends Frame
  14. {
  15.     // XMLViewerFrame constructor
  16.     //--------------------------------------------------------------------------
  17.     public XMLViewerFrame(String str, Applet parent)
  18.     {
  19.         // TODO: Add additional construction code here
  20.         super (str);
  21.         alive = true;
  22.         this.parent = parent;
  23.     }
  24.  
  25.     // The handleEvent() method receives all events generated within the frame
  26.     // window. You can use this method to respond to window events. To respond
  27.     // to events generated by menus, buttons, etc. or other controls in the
  28.     // frame window but not managed by the applet, override the window's
  29.     // action() method.
  30.     //--------------------------------------------------------------------------
  31.     public boolean handleEvent(Event evt)
  32.     {
  33.         switch (evt.id)
  34.         {
  35.             // Application shutdown (e.g. user chooses Close from the system menu).
  36.             //------------------------------------------------------------------
  37.             case Event.WINDOW_DESTROY:
  38.                 alive = false;
  39.                 dispose();
  40.                 return true;
  41.  
  42.             default:
  43.                 return super.handleEvent(evt);
  44.         }             
  45.     }
  46.  
  47.     public boolean action(Event  evt, Object  what)
  48.     {
  49.         if( parent != null )
  50.             return parent.handleEvent(evt);
  51.         else
  52.             return false;
  53.     }
  54.  
  55.     public boolean isAlive()
  56.     {
  57.         return alive;
  58.     }
  59.  
  60.     Applet parent;
  61.     boolean alive;
  62. }
  63.