GUI Builder Runtime Classes
Applets and applications developed with GUI builder require GUI
builder runtime classes to run outside of the Java WorkShop
environment. The runtime classes consist of:
- Shadow (wrapper) classes for the standard AWT components,
including workarounds that help AWT-based programs run better
- Framework base classes, required for writing custom groups and
shadows
- Type converters that convert any type to a string and vice
versa
- Components such as the Tabbed Folder Panel, Image
Label, and Multiple Column List
GUI builder uses runtime classes instead of duplicating runtime code
in the application for a number of reasons:
- Groups provide public interfaces and base classes that allow GUIs
created with GUI builder to be included in other GUIs created with GUI
builder. Any application generated using GUI builder can be included
within another GUI builder application.
- A number of workarounds for AWT problems have been
included in the shadow classes and in AWT subclasses
included in the runtime classes. These workarounds make it
possible to build complex applications that work on both
Windows and Solaris systems.
- Shadow classes permit delayed instantiation of
components at runtime. Components are not instantiated
until they are displayed the first time--this results in
better startup performance. There is minimal overhead
associated with using shadow classes.
- Generated code is smaller and simpler. Browsers that
can cache classes perform better when
loading a second applet if the second applet uses the same
runtime classes--only the small generated class specific to
the second applet is loaded.
- Shadow classes allow names and attributes for AWT
components to be recorded. This feature allows you to
change the location of the component without having to
change the operation information about the component.
How to Use the Runtime Classes
The runtime classes are located in the following
directory:
On Solaris:
install-dir-path/JWS/classes/sunsoft/jws/visual/rt
On Microsoft Windows 95 and Windows NT:
install-dir-path\JWS\classes\sunsoft\jws\visual\rt
You can redistribute the GUI builder runtime classes with
your applications. They can be copied into the directory
containing your application's main class file, in which
case they will be downloaded by the applet class loader of
the browser or viewer. Or they can be installed locally on
the client side and specified in the CLASSPATH variable.
To copy the runtime classes into an application directory,
copy the contents of:
On Solaris:
install-dir-path/JWS/lib/visualrt.zip
On Microsoft Windows 95 and Windows NT:
install-dir-path\JWS\lib\visualrt.zip
into the directory that contains the main applet class. On
a UNIX system, you can make a link to the sunsoft classes
directory rather than an actual copy.
The first time you run an applet that requires the runtime classes,
there is a delay while the runtime classes are down-loaded. Once the
classes are cached, there is relatively little delay when subsequent
applets are run, unless the applets use runtime classes not already
used by the applets preceding it.
Performance is significantly better if the runtime classes are
installed locally and accessed via the CLASSPATH variable. The time it
takes to download the runtime classes is affected more by the number
of classes than the size. Most browsers create a new connection to
download each class, which is very slow.
Netscape Navigator
For Solaris only: If an applet is run in Netscape Navigator and the GUI
builder runtime classes are installed locally, Navigator must be
started after the CLASSPATH variable has been set.
If Navigator fails to find the GUI builder runtime classes,
you will probably see one of the following error messages:
Applet can't start: class bar got a security
violation: method verification error.
Applet can't start: error.java.lang.NoClassDefFoundError
You may run into situations where it is necessary to
restart Navigator if it has previously failed to find the
runtime classes.
Use Zip Archives to Improve Performance
Netscape Navigator version 3.0 and later can load the
runtime classes from a zip archive. Loading the classes from
the zip archive reduces the time it takes your applet to
start because a single, large file is downloaded from the
server rather than many smaller ones.
To use this method, copy the archive file:
On Solaris:
install-dir/lib/visualrt.zip
On Microsoft Windows 95 and Windows NT:
install-dir\lib\visualrt.zip
to the applet's codebase directory along with the applet's class files.
See also:
- Generating Java Source Code
- Adding Operations to Components
- What Is a Component Operation?
- What Are Groups and Shadows?
- More On Using Groups and Shadows
- Visual Java GUI Builder API Documentation
- Visual Java GUI
Builder Runtime Packages
- Class Hierarchy
- Index of
All Fields and Methods