TOC PREV NEXT INDEX




Creating and Configuring a StormBase


This section covers the basics of setting up ice.storm.StormBase, which is the main class exposing the core functionality of the ICEreader SDK. For a thorough example, see Tutorial: Building a Browser.

Your code requires at least one import statement. The ice.storm package is always required.

You can then create the StormBase object:

StormBase stormBase = new StormBase( );
 

This object manages the pilots and scripter, keeps track of the history, displays the content in the GUI component, and so on.

Configuring GUI Toolkit Support

The ICEreader SDK is GUI toolkit-neutral. The core classes do not depend on heavyweight AWT or lightweight Swing components. When the core needs a reference to a GUI, it uses only the most basic classes, such as java.awt.Component, java.awt.Graphics, and java.awt.Color.

Your application is responsible for creating GUI elements such as navigation buttons, location fields, and so on. Make sure your application provides its own callback or container, so that it can use any widget set required.

To specify the GUI toolkit that the StormBase and the pilots use, use the following method:

// Tell StormBase and the pilots to use Swing

stormBase.setComponentToolkitName("swing");
 

Form controls inside rendered Web pages are then displayed using the chosen GUI toolkit.

You can specify either the AWT or Swing toolkit ("awt" or "swing").

SWT applications are supported via the SWT_AWT Bridge component. When using ICEreader with an SWT application, you must still configure the toolkit mode to either "awt" or "swing". Note that HTML form controls are rendered using the configured toolkit and not using native SWT components.

Example: Using Swing

The following code example shows a Swing configuration:

import ice.storm.StormBase;

import javax.swing.*;
 
public class Swing {

    final static public void main(String args[]) {

         StormBase stormBase = new StormBase();

         stormBase.setComponentToolkitName("swing");

         JFrame f = new JFrame("Web Viewer");

         JPanel htmlPanel = new JPanel();

         f.getContentPane().add(htmlPanel);

         stormBase.setContainer(htmlPanel,"demoPanel");

         f.setSize(300,300);

         f.setVisible(true);

         stormBase.renderContent("http://www.icesoft.com",null,"demoPanel");

    }

}
 


Copyright 2005. ICEsoft Technologies, Inc.
http://www.icesoft.com

TOC PREV NEXT INDEX