[ Back | Previous | Next ]

How lauch an application from the browser in a frame?

Package:
java.applet.*
Product:
JDK
Release:
1.1.x
Related Links:
General
General
General
Comment:
import java.awt.*;
import java.awt.event.*;
public class PicOrganizerApplet extends java.applet.Applet {

   Frame f = new Frame("Picture Organizer v1.0");
   PicOrganizerGui pog = null;

   public void init() {
      f.setSize(500,300);
      f.addWindowListener( this. new AppAdapter() );
      f.add( pog = new PicOrganizerGui() );
      pog.init();
      //pog.start();
      f.setVisible( true );
   }

   public void stop() {
      f.setVisible( false );
   }

   public void start() {
      f.setVisible( true );
   }

      //
        // WINDOW HANDLING
        //
        class AppAdapter extends WindowAdapter {
            public void windowClosing(WindowEvent event) {
            if (f != null )    
               f.setVisible( false );
            }
        }

   public void destroy() {
      f.setVisible( false );
      f.dispose();
   }
}