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 JavaTM SE Runtime
Environment (JRE) is
required to run the viewer as a stand-alone application, whereas
The JavaTM SE Development Kit (JDK), which includes
the JRE, is
required to use the class library in your own JavaTM
Both packages can be downloaded from the
Oracle® Software Downloads page.
The search tree viewer may be installed in two different ways:
- The stand-alone application only. If you have the
JavaTM runtime installed, the
simplest way to install the viewer as a stand-alone
application is to click here to install
and launch the viewer. (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.)
- 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
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,
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
The following demos use the viewer package to render trees:
Last updated November 25, 2010.
Oracle and Java are registered trademarks of Oracle and/or its
affiliates. Other names may be trademarks of their respective
Microsoft, .NET, Windows, and Visual Studio are either registered
trademarks or trademarks of Microsoft Corporation in the United States
and/or other countries.