int pageCount = (int) (c.getMaxHeight() / c.getPageInfo().getContentHeight() + 1);
int pageCount = getPageCount(c);
    private void renderPagedView(Context c, Box box) {        int pageCount = (int) (c.getMaxHeight() / c.getPageInfo().getContentHeight() + 1);        setPreferredSize(new Dimension(c.getMaxWidth(),                (int) (pageCount * c.getPageInfo().getContentHeight() +                pageCount * c.getPageInfo().getMargins().top +                pageCount + c.getPageInfo().getMargins().bottom)));        revalidate();        PageInfo info = c.getPageInfo();        Border margins = info.getMargins();        Graphics2D g = c.getGraphics();        Shape working = g.getClip();        for (int i = 0; i < pageCount; i++) {            c.setCurrentPage(i + 1);            g.setClip(working);            g.clip(new Rectangle(margins.left,                    (int) (i * info.getContentHeight() + i * margins.top + i * margins.bottom + margins.top),                    (int) info.getContentWidth(), (int) info.getContentHeight()));            g.translate(margins.left, i * margins.top + i * margins.bottom + margins.top);            BoxRendering.paint(c, box, false, false);//no restyle demanded on top level            g.translate(-margins.left, -(i * margins.top + i * margins.bottom) + -margins.top);            Stroke oldStroke = g.getStroke();            Color oldColor = g.getColor();            if (i > 0) {                g.setClip(working);                g.setStroke(new BasicStroke(3));                g.setColor(Color.BLACK);                g.drawLine(0,                        (int) (i * info.getContentHeight() + i * margins.top + i * margins.bottom),                        (int) info.getContentWidth() + margins.left + margins.right,                        (int) (i * info.getContentHeight() + i * margins.top + i * margins.bottom));                g.setColor(oldColor);                g.setStroke(oldStroke);            }        }    }