edu.ksu.cis.viewer
edu.ksu.cis.viewer is a JavaTM package of tools for
viewing and manipulating trees. The package includes an applet that may be run in your browser. A
portion of this package has been ported to
the Microsoft® .NET Framework.
The remainder of this page describes how to install and use the
package on your own platform. The Java SE Runtime Environment is
required.
Installation
The search tree viewer may be installed in two different ways:
- Using JavaTM
Web Start. This is the simplest way to install the viewer if
you only want to run it as a stand-alone application. If you have
JavaTM Web Start installed, you may simply click here to launch the viewer as a
stand-alone application. (For those who have difficulty
distinguishing red from black, the monochrome version might
be more appropriate. This version differs from the original
only in that instead of using the color red, it uses the
color gray. Turning on bold and increasing the font size
may help in distinguishing gray from black.) The
application will be cached by Web
Start, and may subsequently be started via the Application Manager.
Running the program through the Application Manager does not require
internet access; however, the Application Manager will attempt to
determine whether an update is available prior to starting the
application. On Windows, shortcuts may be added to the desktop and/or
Start menu using the Application Manager (the second time you run the
application, you will be asked whether you want this done).
- Manual download. If you want to be able to use the
edu.ksu.cis.viewer class library in your own programs,
you will want to download the file viewer.jar (39K). This file is a
JAR archive. Normally there is no need to unpack
it. The program can be run by issuing the command
java -jar viewer.jar
Please note that all letters must be lower-case in the above command.
On Windows, the application can also be run by double-clicking on the
viewer.jar icon.
Usage
There are two main uses of this package.
- Search Tree Viewer. This is the stand-alone application
(or applet) for manipulating and visualizing search trees. The
program may be started as described above.
To create and manipulate a tree, enter any string in the text
field in the upper left-hand corner, and press either the Put
button to add that string as a key to the tree, or the Remove
button to remove that key from the tree. The keys will be
maintained in lexicographic order. The Back and Forward buttons
allow you to move through the history of your tree construction.
The Clone button opens a new window with an exact copy of the
tree and history in your current window; the tree in this window
can then be manipulated independently.
Important Note: This applet treats all keys as strings.
You may enter numbers, but be aware that they will be treated as
strings (e.g., "10" < "5"). Virtually all of the questions
I've received regarding this program have reflected a
misunderstanding of this fact.
- Tools for viewing trees built from user code. In order to be
able to implement a tree that can be displayed using this
package, you must write your tree class to implement TreeInterface.
If you wish to have colored nodes, you will also need to provide
a class that implements Colorizer. You
may then use the TreeDrawing,
TreeComponent,
and/or TreeFrame
classes to display your tree. If you didn't add this package to
your CLASSPATH, you will need to specify it when you
compile and run your program; e.g.:
javac -classpath viewer.jar *.java
java -cp .;viewer.jar MyClass.java
(On unix, the ";" is replaced by a ":".)
The complete package documentation can be
browsed online.
Other Downloads
Related Demos
The following demos use the viewer package to render trees:
Last updated October 20, 2009.
Rod Howell
(rhowell@ksu.edu)
Sun, Sun Microsystems, the Sun Logo, and Java are trademarks or
registered trademarks of Sun Microsystems, Inc. in the United States
and other countries.