if (args.length != 1) {
System.err.println("Usage is: java VSX2 testfile.xml");
System.exit(1);
}
JFrame frame = new JFrame("Tree Renderer Test");
VSX2 parser = new VSX2();
JTree tree = new JTree(parser.parse(args[0]));
// Steal the default icons from the default renderer...
DefaultTreeCellRenderer rend1 = new DefaultTreeCellRenderer();
IconAndTipRenderer rend2 = new IconAndTipRenderer(
rend1.getOpenIcon(),
rend1.getClosedIcon(),
rend1.getLeafIcon());
tree.setCellRenderer(rend2);
ToolTipManager.sharedInstance().registerComponent(tree);
frame.getContentPane().add(new JScrollPane(tree));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(300,400);
frame.setVisible(true);