panel.setPreferredSize( new Dimension( text_width, text_width ) );
int width = 360; int height = 500; panel.setPreferredSize( new Dimension( width, height ) );
    public HTMLTest( String[] args )        throws Exception {        super( BASE_TITLE );        panel = new XHTMLPanel();        panel.setPreferredSize( new Dimension( text_width, text_width ) );        JScrollPane scroll = new JScrollPane( panel );        scroll.setVerticalScrollBarPolicy( scroll.VERTICAL_SCROLLBAR_ALWAYS );        scroll.setHorizontalScrollBarPolicy( scroll.HORIZONTAL_SCROLLBAR_ALWAYS );        scroll.setPreferredSize( new Dimension( text_width, text_width ) );        panel.addMouseListener( new LinkListener( panel ) );        HoverListener hov = new HoverListener(panel);        panel.addMouseListener(hov);        panel.addMouseMotionListener(hov);        if ( args.length > 0 ) {            loadDocument( args[0] );        }        getContentPane().add( "Center", scroll );        JMenuBar mb = new JMenuBar();        JMenu file = new JMenu( "File" );        mb.add( file );        file.setMnemonic( 'F' );        file.add( new QuitAction() );        JMenu view = new JMenu( "View" );        mb.add( view );        view.setMnemonic( 'V' );        view.add( new RefreshPageAction() );        view.add( new ReloadPageAction() );        JMenu test = new JMenu( "Test" );        mb.add( test );        test.setMnemonic( 'T' );        String demoRootDir = "demos/browser/xhtml";        addFileLoadAction( test, "One Liner", demoRootDir + "/one-line.xhtml" );        addFileLoadAction( test, "Background Colors/Images", demoRootDir + "/background.xhtml" );        addFileLoadAction( test, "Borders", demoRootDir + "/border.xhtml" );        addFileLoadAction( test, "Box Sizing", demoRootDir + "/box-sizing.xhtml" );        addFileLoadAction( test, "Mixed Test (1)", demoRootDir + "/content.xhtml" );        addFileLoadAction( test, "Line Breaking", demoRootDir + "/breaking.xhtml" );        addFileLoadAction( test, "Headers", demoRootDir + "/header.xhtml" );        addFileLoadAction( test, "Inline Image", demoRootDir + "/image.xhtml" );        addFileLoadAction( test, "List ", demoRootDir + "/list.xhtml" );        addFileLoadAction( test, "Nesting", demoRootDir + "/nested.xhtml" );        addFileLoadAction( test, "General Styled Text", demoRootDir + "/paragraph.xhtml" );        addFileLoadAction( test, "CSS Selectors", demoRootDir + "/selectors.xhtml" );        addFileLoadAction( test, "Table", demoRootDir + "/table.xhtml" );        addFileLoadAction( test, "Text Alignment", demoRootDir + "/text-alignment.xhtml" );        addFileLoadAction( test, "Whitespace Handling", demoRootDir + "/whitespace.xhtml" );        addFileLoadAction( test, "iTunes Email", demoRootDir + "/itunes/itunes1.xhtml" );        addFileLoadAction( test, "Follow Links", demoRootDir + "/link.xhtml" );        addFileLoadAction( test, "Hamlet (slow!)", demoRootDir + "/hamlet.xhtml" );        addFileLoadAction( test, "extended", demoRootDir + "/extended.xhtml" );        addFileLoadAction( test, "XML-like", demoRootDir + "/xml.xhtml" );        addFileLoadAction( test, "XML", demoRootDir + "/xml.xml" );        addFileLoadAction( test, "pseudo-element", "/home/tobe/Projekt/xhtmlrenderer/test.xhtml" );        JMenu debug = new JMenu( "Debug" );        mb.add( debug );        debug.setMnemonic( 'D' );        JMenu debugShow = new JMenu( "Show" );        debug.add( debugShow );        debugShow.setMnemonic( 'S' );        debugShow.add( new JCheckBoxMenuItem( new BoxOutlinesAction() ) );        debugShow.add( new JCheckBoxMenuItem( new LineBoxOutlinesAction() ) );        debugShow.add( new JCheckBoxMenuItem( new InlineBoxesAction() ) );        debugShow.add( new JCheckBoxMenuItem( new FontMetricsAction() ) );                        JMenu anti = new JMenu("Anti Aliasing");        anti.add( new JCheckBoxMenuItem( new AntiAliasedAction("None", TextRenderer.NONE) ) );        anti.add( new JCheckBoxMenuItem( new AntiAliasedAction("Low (Default)", TextRenderer.LOW) ) );        anti.add( new JCheckBoxMenuItem( new AntiAliasedAction("Medium", TextRenderer.MEDIUM) ) );        anti.add( new JCheckBoxMenuItem( new AntiAliasedAction("Highest", TextRenderer.HIGH) ) );        debug.add( anti );        debug.add( new ShowDOMInspectorAction() );/*        debug.add(                    new AbstractAction( "Print Box Tree" ) {                        public void actionPerformed( ActionEvent evt ) {                            panel.printTree();                        }                    } );*/        setJMenuBar( mb );    }