home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 July & August / Pcwk78a98.iso / Micrsoft / VJ / VJ98 / VJPROJS / WEBPAGES / CODEHTM / CODEHTM.JAV < prev    next >
Text File  |  1998-02-11  |  1KB  |  50 lines

  1. // Class1.java
  2.  
  3. import wfc.html.*;
  4.  
  5. /**
  6.  * This class is hosted on an HTML page as a COM object.
  7.  * Program execution begins with the documentLoad() method.
  8.  * When the HTML document has loaded, this method is envoked.
  9.  */
  10. public class Class1 extends DhModule
  11. {
  12.     DhDocument dhdoc;
  13.     
  14.     /**
  15.      * The main entry point for the program. 
  16.      *
  17.      * @param sender The Object that initiated the call to this method
  18.      * @param event  The DhEvent that the sender generated
  19.      */
  20.     public void documentLoad(Object sender, DhEvent event)
  21.     {    
  22.         initForm();
  23.     }
  24.  
  25.     /**
  26.      * Connects to the HTML document and manipulates elements on the
  27.      * page.
  28.      */
  29.     void initForm()
  30.     {
  31.         dhdoc = getDocument();
  32.         
  33.         dhdoc.add(new DhText("Class1"));
  34.  
  35.         // TODO: Add additional initialization code here
  36.         
  37.         /** 
  38.          * New controls can be added to the page dynamically from code:
  39.          *     DhButton button1 = new DhButton("button1");
  40.          *     dhdoc.add(button);
  41.          *  Existing HTML elements can be manipulated, too:
  42.          *     DhButton button2 = (DhButton) dhdoc.findElement("button2");
  43.          *     button2.setText("New caption");    
  44.          *  This method assumes that the "button2" element already exists
  45.          *  in Page1.htm:
  46.          *     <INPUT TYPE=BUTTON ID="button2" VALUE="Old caption">
  47.          */
  48.     }
  49. }
  50.