Java Reference
In-Depth Information
f . addWindowListener ( new
new WindowAdapter () {
public
public void
void windowClosing ( WindowEvent e ) {
f . setVisible ( false
false );
f . dispose ();
System . exit ( 0 );
}
});
Container cp = f . getContentPane ();
cp . setLayout ( new
new BorderLayout ());
// Instantiate the AppletAdapter which gives us
// AppletStub and AppletContext.
iif ( aa == null
null )
aa = new
new AppletAdapter ();
// The AppletAdapter also gives us showStatus.
// Therefore, must add() it very early on, since the Applet's
// Constructor or its init() may use showStatus()
cp . add ( BorderLayout . SOUTH , aa );
showStatus ( "Loading Applet " + appName );
loadApplet ( appName , WIDTH , HEIGHT );
// sets ac and ai
iif ( ai == null
null )
return
return ;
// Now right away, tell the Applet how to find showStatus et al.
ai . setStub ( aa );
// Connect the Applet to the Frame.
cp . add ( BorderLayout . CENTER , ai );
Dimension d = ai . getSize ();
d . height += aa . getSize (). height ;
f . setSize ( d );
f . setVisible ( true
true );
// make the Frame and all in it appear
showStatus ( "Applet " + appName + " loaded" );
// Here we pretend to be a browser!
ai . init ();
ai . start ();
}
/*
* Load the Applet into memory. Should do caching.
Search WWH ::




Custom Search