Getting Started with the HTML Component in the BeanBox
This document provides an example of how you might go about setting up a browser using the HotJava HTML Component (Version 1.0) beans in the BeanBox. Follow these steps to get an idea of how things work.

This may look like a lot of steps, but these steps are easy. Aside from downloading the Beans Development Kit, the entire process should only take a few minutes.

To submit a bug about the HotJava HTML Component or the Beans Development Kit, use the JavaSoft Report a Bug or Request a Feature form. Before submitting a bug, please first check out the HotJava HTML Component Known Bugs page.

Setting Up The BeanBox and HotJavaBrowser Bean
Download the BDK
  1. Download the latest Beans Development Kit (BDK) from http://java.sun.com/beans/bdk_download.html
  2. Copy the HotJava Bean files HotJavaBean.jar and TextBean.jar to the BeanBox jars directory. Example:
    % cp your-HJBean-dir/HotJavaBean.jar your-beanbox-dir/jars/HotJavaBean.jar
    % cp your-HJBean-dir/TextBean.jar your-beanbox-dir/jars/TextBean.jar (Solaris)
    or
    C:\> copy your-HJBean-dir\HotJavaBean.jar your-beanbox-dir\jars\HotJavaBean.jar
    C:\> copy your-HJBean-dir\TextBean.jar your-beanbox-dir\jars\TextBean.jar (Windows)
Running The BeanBox
Run The BeanBox
  1. Move to where the BeanBox binary is installed. Example:
    % cd your-beanbox-dir/beanbox
  2. Run the BeanBox. Example:
    % sh run.sh (Solaris)
    or
    C:\> run (Windows)
Creating Your Browser with the HotJava BrowserBean
Create the Beans
  1. Select the HotJavaSystemState Bean in the ToolBox. The pointer changes into a crossbar.
  2. Position the mouse in the upper right corner of the bean box and click.
    This should paste the HotJavaSystemState Bean item in the bean box.
  3. Click on the Edit section of the SystemPropertiesDefaults field in the Properties window. The Properties window always displays the properties of the currently selected bean.
    This opens the System Properties Editor window.
  4. Set your proxies in the System Properties Editor window. Use the tab key to move between fields. You must do this step before you continue.
  5. Select the Text Bean in the ToolBox. The pointer changes into a crossbar.
  6. Position the mouse in the upper left hand corner of the bean box and click.
    This should paste the Text Bean item in the bean box.
  7. Select the HotJavaDocumentStack Bean from the ToolBox.
  8. Position the mouse below the Text Bean and click.
    This should paste the HotJavaDocumentStack Bean item in the bean box.
  9. Select the OrangeButton Bean from the ToolBox. (You can use any color button. This is just an example.)
  10. Position the mouse to the right of the Text Bean and click.
    This should paste the OrangeButton Bean item in the bean box.
  11. Enter Back in the label field displayed in the Properties window.
  12. Select the BlueButton Bean from the ToolBox.
  13. Position the mouse to the right of the Back Button Bean and click.
    This should paste the Blue Button Bean item in the bean box.
  14. Enter Forward in the label field displayed in the Properties window.
  15. Select the HotJavaBrowser Bean from the ToolBox.
  16. Position the mouse below all the other Beans and click.
    This displays an evaluation notice. Read the notice and click Ok.
    This should paste the HotJavaBrowser Bean item in the bean box.
  17. Select the AuthenticatorBean from the ToolBox.
  18. Position the mouse at the upper right corner of the bean box and click.
    This should paste the AuthenticatorBean item in the bean box.
  19. Increase the size of the BeanBox, and increase the size of the HotJavaBrowser Bean within the BeanBox so that it is an appropriate size to display pages.
Creating the Browser by Connecting the Beans
Connect Browser Bean to Text Bean
  1. Select the HotJava Browser Bean in the BeanBox. This displays a black, dashed-line border around the selected bean.
  2. From The BeanBox menus, choose Edit->Bind property.
    A Properties dialog opens.
  3. Select the documentString property.
  4. Click Ok.
  5. Move your mouse until you locate the red line extending fro the Browser bean.
  6. Position the red line on the edge of the Text Bean and click.
  7. Select the text property.
  8. Click Ok.
Connect Text Bean to Browser Bean
  1. Select the Text Bean in the BeanBox.
  2. Choose Edit->Bind property.
    A dialog opens with the text property.
  3. Select the text property.
  4. Click Ok.
  5. Move your mouse until you locate the red line extending from the Text bean.
  6. Position the red line on the edge of the HotJavaBrowser Bean and click.
    A dialog is displayed with the list of target properties.
  7. Select the documentString Property.
  8. Click Ok.
Connect Document Stack to Browser Bean
  1. Select the HotJavaDocumentStack Bean in the BeanBox.
  2. Choose Edit->Events->Browser history commands->executeHistoryCommand.
  3. Move your mouse until you locate the red line.
  4. Position the red line on the edge of the HotJavaBrowser Bean and click.
  5. Select the executeHistoryCommand target method.
  6. Click Ok.
Connect Browser Bean Back to Document Stack
  1. Select the HotJavaBrowser Bean in the BeanBox.
  2. Choose Edit->Events->Browser history commands->executeHistoryCommand.
  3. Move your mouse until you locate the red line.
  4. Position the red line on the edge of the HotJavaDocumentStack Bean and click.
  5. Select the executeHistoryCommand target method.
  6. Click Ok.
Connect The Back Button
  1. Select the Back Button.
  2. Choose Edit->Events->button push->actionPerformed.
  3. Move your mouse until you locate the red line.
  4. Position the red line on the edge of the HotJavaDocumentStack Bean.
  5. Select the previousDocument target method.
  6. Click Ok.
Connect the Forward Button.
  1. Select the Forward Button.
  2. Choose Edit->Events->button push->actionPerformed.
  3. Move your mouse until you locate the red line.
  4. Position the red line on the edge of the HotJavaDocumentStack Bean.
  5. Select the nextDocument target method.
  6. Click Ok.
HotJavaSystemState Bean There are no connections required for the HotJava System State bean to work.
Authenticator Bean There are no connections required for the Authenticator bean to work.
Verifying, Using, and Saving Your Browser
Test the Connections
  1. Load a URL (e.g. http://CNN.com) into the Text Bean, and verify that the page loads.
  2. Click on any link, and verify that the link loads.
  3. Click on the Back Button, and verify that the previous page loads.
  4. Click on the Forward Button, and verify that the next page loads.
Disable Design Mode
  1. Choose View->Disable Design Mode.
  2. Choose View->Hide Invisible Beans.
    Your browser is ready to use.
Save Your Browser
  1. Choose File->Save.
  2. In the dialog that displays, type the name of the file to save the browser in.
    The set of beans and connections is saved, along with the page currently loaded in the browser bean. The document stack is not saved.

    The next time you run the BeanBox, you can reload your saved browser by choosing File->Load.


Java, JavaBeans, and JavaSoft are trademarks of Sun Microsystems Inc.

Copyright © 1997 Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, CA 94303 USA.
All rights reserved.