Sun JDK Samples

Objectives
To introduce and demonstrate the use of JDK features in sample applets and applications.

Time Required
60 minutes to become familiar with the contents of the sample projects.

Before You Begin
To add sample projects to your workspace:

  1. Select Quick Start from the File menu.
  2. From the left-hand list, select Feature.
  3. From the right-hand list, select Add Feature.
  4. From the dialog that opens, select Sun JDK Examples.  If Sun JDK Examples does not appear in the list, it means that the projects have previously been added to your workspace.

The Sun JDK Examples projects will be added to your workspace, and the source code will be compiled.

Description
The Sun JDK samples in VisualAge for Java are the samples provided with Sun's JDK product.  You can run, edit, and manage them within the IDE.   See the following URL for detailed descriptions of each sample and the functionality it demonstrates:

http://www.javasoft.com/products/jdk/1.1/docs/relnotes/demos.html

Running a Sample
To run one of the samples:

  1. Find the executable class for the sample.
  2. From the class' pop-up menu, select Run and then either In Applet Viewer (to run as an applet) or Run Main (to run as an application), which ever is enabled.
  3. If the class runs as an applet, the Applet Viewer will start.  If the program uses standard input or output, the Console window will start.

You can change the programs settings or edit its code to change the way the sample works.  If you want to return to the original edition of the sample, simply reload the earliest edition from the repository.

List of Samples

Sample Description
Animator Uses animation and sound effects.
ArcTest Uses arc graphics, painting.
BarChart Uses graphics, painting, fonts.
Blink Uses string tokenizer.
CardTest Demonstrates card layout, mouse events.
Clock Demonstrates writing a clock program.
DitherTest Demonstrates color dithering.
DrawTest Demonstrates a simple graphics editor that uses lines, points, and colors.
Fractal Draws a fractal, listens for mouse events.
GraphicsTest Displays a variety of shapes and colors.
ImageMap Different areas of an image are controlled by ImageArea classes, linked to URLs, sounds, or messages.
JumpingBox Listens for all mouse events.
MoleculeViewer Mouse dragging controls a three-dimensional molecule graphic.
NervousText Demonstrates text animation.
OpenLookButtons Demonstrates Openlook buttons.
RoundButtons Demonstrates Round buttons.
SimpleGraph Graphs a simple mathematic function.
SortDemo Sorts lines of various length according to your choice of algorithm.
Spinner Demonstrates lightweight spinning objects against a background graphic.
SpreadSheet Demonstrates a simple graphical spreadsheet.
SymbolTest Demonstrates how adapter classes can be used to avoid creating empty methods to satisfy an event listener interface.
TicTacToe Demonstrates creating a simple game.
WireFrame Shows how to display a simple three dimensional wire frame, and move it using mouse actions.
Internationalization (i18n) Five Samples: 
  1. CollateDemo demonstrates language sensitive collation.
  2. DateTimeDemo shows how a date/time formatter works.
  3. MessageFormatDemo demonstrates a pattern formatter, which helps with internationalization.
  4. NumberFormatDemo demonstrates how to convert binary numbers into text strings for meaningful display.
  5. TextBoundDemo demonstrates breaking text into meaningful, translatable chunks.