if (enclosingScrollPane != null) {
if (pageInfo != null) { extents = new Rectangle(0, 0, (int) pageInfo.getContentWidth(), (int) pageInfo.getContentHeight()); } else if (enclosingScrollPane != null) {
    protected Context newContext(Graphics2D g) {        XRLog.layout(Level.FINEST, "new context begin");        getContext().setCanvas(this);        getContext().setGraphics(g);        Rectangle extents;        if (enclosingScrollPane != null) {            Rectangle bnds = enclosingScrollPane.getViewportBorderBounds();            extents = new Rectangle(0, 0, bnds.width, bnds.height);            //Uu.p("bnds = " + bnds);        } else {            extents = new Rectangle(getWidth(), getHeight());//200, 200 ) );        }        //Uu.p("newContext() = extents = " + extents);        getContext().setMaxWidth(0);        //getContext().setMaxHeight(0);        XRLog.layout(Level.FINEST, "new context end");        //Uu.p("new context with extents: " + extents);        setRenderWidth((int) extents.getWidth());        return getContext().newContextInstance(extents);    }