home *** CD-ROM | disk | FTP | other *** search
/ Learn Java Now / Learn_Java_Now_Microsoft_1996.iso / MsDev / Samples / Microsoft / JavaCallingCOM / usecomframe.java < prev   
Encoding:
Java Source  |  1996-08-27  |  1.5 KB  |  43 lines

  1. //******************************************************************************
  2. // usecomframe.java:    
  3. //
  4. //******************************************************************************
  5. import java.awt.*;
  6.  
  7. //==============================================================================
  8. // STANDALONE APPLICATION SUPPORT
  9. //     This frame class acts as a top-level window in which the applet appears
  10. // when it's run as a standalone application.
  11. //==============================================================================
  12. class usecomframe extends Frame
  13. {
  14.     // usecomframe constructor
  15.     //--------------------------------------------------------------------------
  16.     public usecomframe(String str)
  17.     {
  18.         super (str);
  19.     }
  20.  
  21.     // The handleEvent() method receives all events generated within the frame
  22.     // window. You can use this method to respond to window events. To respond
  23.     // to events generated by menus, buttons, etc. or other controls in the
  24.     // frame window but not managed by the applet, override the window's
  25.     // action() method.
  26.     //--------------------------------------------------------------------------
  27.     public boolean handleEvent(Event evt)
  28.     {
  29.         switch (evt.id)
  30.         {
  31.             // Application shutdown (e.g. user chooses Close from the system menu).
  32.             //------------------------------------------------------------------
  33.             case Event.WINDOW_DESTROY:
  34.                 dispose();
  35.                 System.exit(0);
  36.                 return true;
  37.  
  38.             default:
  39.                 return super.handleEvent(evt);
  40.         }             
  41.     }
  42. }
  43.