2
|
1 |
SampleTree demonstrates JTree features. Each node of SampleTree has 7
|
|
2 |
children, with each one drawn in a random font and color. Each node is
|
|
3 |
named after its font. While the data isn't interesting, the example
|
|
4 |
illustrates a number of features:
|
|
5 |
|
|
6 |
- Dynamically loading children (see DynamicTreeNode.java)
|
|
7 |
- Adding/removing/inserting/reloading (see the following inner
|
|
8 |
classes in SampleTree.java: AddAction, RemoveAction, InsertAction,
|
|
9 |
and ReloadAction)
|
|
10 |
- Creating a custom cell renderer (see SampleTreeCellRenderer.java)
|
|
11 |
- Subclassing JTreeModel for editing (see SampleTreeModel.java)
|
|
12 |
|
|
13 |
|
|
14 |
To run the SampleTree demo:
|
|
15 |
|
|
16 |
java -jar SampleTree.jar
|
|
17 |
|
|
18 |
These instructions assume that this installation's version of the java
|
|
19 |
command is in your path. If it isn't, then you should either
|
|
20 |
specify the complete path to the java command or update your
|
|
21 |
PATH environment variable as described in the installation
|
|
22 |
instructions for the Java(TM) SE Development Kit.
|
|
23 |
|