u.p("ending count = " + (end_time-start_time) + " msec");
    protected void startLayout(Graphics g) {        //u.p("calcLayout()");        this.removeAll();        //u.p("this = ");        //u.dump_stack();        if ( g == null ) {            //u.p("bad first graphics");            return;        }        //u.p("layout");        //u.p("size = " + this.getSize());        //u.dump_stack();        if ( doc == null ) {            return;        }        Element html = (Element)doc.getDocumentElement();        Element body = x.child( html, "body" );        body = html;        newContext( g );        // set up CSS        // the last added is used first        // start painting        c.setMaxWidth( 0 );        long start_time = new java.util.Date().getTime();        u.p("starting the real layout");        u.p("thread = " + Thread.currentThread());        body_box = layout.layout( c, body );        long end_time = new java.util.Date().getTime();        u.p("ending count = " + (end_time-start_time) + " msec");        if ( enclosingScrollPane != null ) {            if ( this.body_box != null ) {                // CLN                //u.p("bcolor = " + body_box.background_color);                //u.p("body box = " + body_box.hashCode());                this.enclosingScrollPane.getViewport().setBackground( body_box.background_color );            }        }        //u.p("calced height = " + layout.contents_height);//this.html_height);        //u.p("max width = " + c.getMaxWidth());        intrinsic_size = new Dimension( c.getMaxWidth(), layout.contents_height );        //u.p("intrinsic size = " + intrinsic_size);        //u.p("real size = " + this.getSize());        if ( !intrinsic_size.equals( this.getSize() ) ) {            //u.dump_stack();            this.setPreferredSize( intrinsic_size );            //u.p("setting preferred to : " + this.getPreferredSize());            //this.setSize(intrinsic_size);            this.revalidate();            //this.repaint();            //this.setPreferredSize(intrinsic_size);        }        //this.html_height = layout.contents_height;        /*         * if(c.getMaxWidth() > this.getSize().getWidth()) {         * this.max_width = c.getMaxWidth();         * }         * //u.p("html height = " + this.html_height);         * if(c.getMaxWidth() > this.getSize().getWidth()) {         * this.setPreferredSize(new Dimension((int)c.getMaxWidth(),this.html_height));         * this.max_width = c.getMaxWidth();         * this.setMinimumSize(this.getPreferredSize());         * } else {         * this.setPreferredSize(new Dimension((int)this.getSize().getWidth(),this.html_height));         * this.max_width = (int)this.getSize().getWidth();         * }         */        /*         * u.p("size = " + this.getSize());         * u.p("pref size = " + this.getPreferredSize());         * if(!this.getSize().equals(this.getPreferredSize())) {         * u.p("need a repaint");         * u.p("size = " + this.getSize());         * u.p("pref size = " + this.getPreferredSize());         * super.setSize(this.getPreferredSize());         * repaint();         * }         */        //c.getGraphics().setColor(Color.blue);        //c.getGraphics().drawLine(0,0,50,50);        this.fireDocumentLoaded();    }