//****************************************************************************** // helloj1a.java: Applet // //****************************************************************************** import java.applet.*; import java.awt.*; import helloj1aFrame; //============================================================================== // Main Class for applet helloj1a // //============================================================================== public class helloj1a extends Applet { // STANDALONE APPLICATION SUPPORT: // m_fStandAlone will be set to true if applet is run standalone //-------------------------------------------------------------------------- private boolean m_fStandAlone = false; // STANDALONE APPLICATION SUPPORT // The main() method acts as the applet's entry point when it is run // as a standalone application. It is ignored if the applet is run from // within an HTML page. //-------------------------------------------------------------------------- public static void main(String args[]) { // Create Toplevel Window to contain applet helloj1a //---------------------------------------------------------------------- helloj1aFrame frame = new helloj1aFrame("helloj1a"); // Must show Frame before we size it so insets() will return valid values //---------------------------------------------------------------------- frame.show(); frame.hide(); frame.resize(frame.insets().left + frame.insets().right + 320, frame.insets().top + frame.insets().bottom + 240); // The following code starts the applet running within the frame window. // It also calls GetParameters() to retrieve parameter values from the // command line, and sets m_fStandAlone to true to prevent init() from // trying to get them from the HTML page. //---------------------------------------------------------------------- helloj1a applet_helloj1a = new helloj1a(); frame.add("Center", applet_helloj1a); applet_helloj1a.m_fStandAlone = true; applet_helloj1a.init(); applet_helloj1a.start(); frame.show(); } // helloj1a Class Constructor //-------------------------------------------------------------------------- public helloj1a() { // TODO: Add constructor code here } // APPLET INFO SUPPORT: // The getAppletInfo() method returns a string describing the applet's // author, copyright date, or miscellaneous information. //-------------------------------------------------------------------------- public String getAppletInfo() { return "Name: helloj1a\r\n" + "Author: David Green\r\n" + "Created with Microsoft Visual J++ Version 1.1"; } // The init() method is called by the AWT when an applet is first loaded or // reloaded. Override this method to perform whatever initialization your // applet needs, such as initializing data structures, loading images or // fonts, creating frame windows, setting the layout manager, or adding UI // components. //-------------------------------------------------------------------------- public void init() { // If you use a ResourceWizard-generated "control creator" class to // arrange controls in your applet, you may want to call its // CreateControls() method from within this method. Remove the following // call to resize() before adding the call to CreateControls(); // CreateControls() does its own resizing. //---------------------------------------------------------------------- resize(320, 240); // TODO: Place additional initialization code here } // Place additional applet clean up code here. destroy() is called when // when you applet is terminating and being unloaded. //------------------------------------------------------------------------- public void destroy() { // TODO: Place applet cleanup code here } // helloj1a Paint Handler //-------------------------------------------------------------------------- public void paint(Graphics g) { g.drawString("Hello Again", 10, 20); } // The start() method is called when the page containing the applet // first appears on the screen. The AppletWizard's initial implementation // of this method starts execution of the applet's thread. //-------------------------------------------------------------------------- public void start() { // TODO: Place additional applet start code here } // The stop() method is called when the page containing the applet is // no longer on the screen. The AppletWizard's initial implementation of // this method stops execution of the applet's thread. //-------------------------------------------------------------------------- public void stop() { } // TODO: Place additional applet code here }