DOMTreePane.java



import org.xml.sax.*;
import javax.swing.*;

/** Scrollable DOM Tree Pane */
public class DOMTreePane extends JScrollPane {

  /** the Tree object */
    public JTree tree;

  /** constructor */
    public DOMTreePane( InputSource source ) {

        DOMTree domtree = new DOMTree( source );
        tree = domtree.tree;
        getViewport().setView( tree );
    }

  /** start here */
    public static void main( String[] argv ) {
        try {
            InputSource source = new InputSource( argv[0] );
            DOMTreePane pane = new DOMTreePane( source );
            JFrame frame = new JFrame( "DOM Tree Pane" );
            frame.getContentPane().add( pane, "Center" );
            frame.pack();
            frame.show();
        }
        catch( Exception e ) {
            System.err.println( e.toString() );
        }
    }
}