import java.awt.*;
import javax.swing.*;
import stathelp.*;
public class HelpTreeExample
{
public
static void main(String[] args)
{
String[][][] firstTree =
{ { {"root", "country I",
null}},
{ {"country I", "family A",
null},
{"country I", "family B", null} },
{ {"family A", "child 1",
"childA1.html"},
{"family A", "child 2",
"childA2.html"},
{"family B", "child 1",
"childB1.html"},
{"family B", "child 2",
"childB2.html"} } };
String[][][] secondTree =
{ { {"root", "Science",
null} },
{ {"Science", "Statistics",
null},
{"Science", "Computer Science", null} },
{ {"Statistics", "Applied Statistics", null},
{"Computer Science", "Design Patterns",
"DesignPatterns.html"}},
{ {"Applied Statistics", "Linear
Regression",
"LinearRegression.html"},
{"Applied Statistics", "Nonparametric Regression",
"NonparametricRegression.html"} } };
String[][][][] testTreeAttribute =
{firstTree, secondTree};
//
Note: HTML files should be put in the directory "C:/resources"!!
DefaultHelper helper1 = new DefaultHelper(
testTreeAttribute,
new String[]
{"Families", "Science"}, "C:/resources");
helper1.setVisible(true);
JFrame jf = new JFrame();
jf.setSize(800,
600);
JDesktopPane desktopPane = new JDesktopPane();
desktopPane.add(helper1);
JPanel contentPane = (JPanel) jf.getContentPane();
contentPane.setLayout(new BorderLayout());
contentPane.add(desktopPane, BorderLayout.CENTER);
jf.setVisible(true);
}
}
Results:
