Java Examples
This sample database contains a collection of live code examples that illustrates
techniques for developing client applications written in Java.
These examples reside in the Examples3_Java database.
This page covers the following topics:
Description of the Examples3_Java database

When you develop Java clients in SilverStream, you create interactive
forms that provide a powerful graphical
front end to a database application. Besides providing an interactive user
interface, forms are also programmable controls that have their own set of
properties, methods, and events.
You can implement a form as a standalone container for other controls,
as a subform on a container form, and as a dialog box that opens in a
separate window.
Typically, you design a Java interface for clients when you want intranet
users to run your application as a dedicated program. Types of Java clients
include:
- SilverStream forms running in SilverJRunner
- External forms or applications
In the Examples3_Java database, you will find examples that demonstrate
numerous techniques for developing Java clients, including:
-
Implementing data source objects to access a tab-delimited file, access a
relational database, execute an SQL query against a data source, and return
data using the java.SQL.ResultSet.
-
Creating different types of dialogs that appear in response to a button click.
-
Sharing global methods, constants, and variables between forms.
-
Communicating from a subform to a parent form.
-
Transferring data between the Java client application and a database.
-
Implementing a listener to determine which control on a form has focus.
-
Implementing an image picker form that lets users select an image, then
insert the image in an HTML Edit control. The example provides three ways
to insert the image: from a repository in the SilverStream database, by browsing
the file system, and by entering a URL.
-
Working with layout managers.
-
Using Java coding techniques to load and navigate arrays, cast objects to different
data types, change the color of form controls, convert from one data type to another,
set fonts programmatically, create and manipulate hashtables, and use Java reflection to
obtain information about selected classes.
-
Programming Java Swing controls, including JProgressMeter, JSlider, JTable, and
JTree.
-
Manipulating, formatting, and updating data within Java-based views.
-
Creating animations on a form using .gif images.
-
Intercepting and processing keystrokes entered by a user.
-
Building and displaying menus for forms.
-
Developing a menu-based text editor form that implements functions you
would find on a Notepad application, such as clipboard operations.
-
Using SilverStream programming techniques to implement operations
such as handling data concurrency errors, creating controls that
dynamically bind to a dataset, validating data on a form, implementing
context-sensitive help, using JavaBeans on a form, writing security
access expressions for objects, using a servlet to manage a database,
using the Session Object to share information between forms, and writing
methods in utility classes that can be called from other classes.
-
Using SilverStream 2.0 form controls, including getting values from a drop-down
list, activating an image button in hover mode, obtaining the control state
of a radio button, simulating a clicked event, and starting and stopping the
timer control.
How to get started

To begin exploring these examples, follow these steps:
-
install and run the Examples3_Java database.
The application starts up in your browser, as shown:
-
Browse through the list in the left navigation pane
and select examples of interest.
A description of the example you select appears in the right pane.
-
Click the Show Example button to bring up the live example, as shown
in this display:
As you can see, this display includes a View Documentation
button which, when pressed, brings up a detailed description of the
technique illustrated in the example.
Java techniques

To learn how to implement Java techniques and access sample code
that you can incorporate in your applications,
go to Application Techniques
in the help system:
Java Client Techniques,
Data Access Techniques,
Core Programming Techniques,
Triggered Business Object Techniques, and
Administration Techniques.
Where to find more information

For more information about developing
Java clients, see Form Designer
in the Tools Guide and
the following
chapters in the Programmer's Guide: