home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / VCAFE.3.0A / Sample.bin / MainFrame.java < prev    next >
Text File  |  1997-09-06  |  1KB  |  44 lines

  1. /*
  2.  *  MainFrame.java
  3.  *
  4.  *  class MainFrame provides a placeholder for applet
  5.  *  Applet1 to be run in an application.
  6.  */
  7.  
  8. package samples.conversion;
  9.  
  10. import java.awt.*;
  11. import java.awt.event.*;
  12.  
  13. class MainFrame extends Frame
  14. {
  15.     public MainFrame( String title )
  16.     {
  17.         super( title );
  18.         enableEvents( AWTEvent.WINDOW_EVENT_MASK );
  19.     }
  20.  
  21.     public void processWindowEvent( WindowEvent e )
  22.     {
  23.         if( e.getID() == WindowEvent.WINDOW_CLOSING )
  24.         {
  25.             setVisible( false );
  26.             dispose();
  27.             System.exit( 0 );
  28.         }
  29.         super.processWindowEvent( e );
  30.     }
  31.  
  32.     public static void main( String args[] )
  33.     {
  34.         Applet1 applet = new Applet1();
  35.         MainFrame window = new MainFrame( "Scrolling Text" );
  36.         window.setSize( 370, 480 );
  37.         window.setLocation( 100, 100 );
  38.         window.add( applet );
  39.         window.addNotify();
  40.         applet.init();
  41.         window.show();
  42.         applet.start();
  43.     }
  44. }