if (working.intersects(overall)) {
Rectangle bounds = new Rectangle(overall); bounds.width += 1; bounds.height += 1; if (working.intersects(bounds)) {
    private void paintPagedView(RenderingContext c, Layer root) {        if (root.getLastPage() == null) {            return;        }                root.assignPagePaintingPositions(c, PAGE_PAINTING_CLEARANCE);        setPreferredSize(new Dimension(                root.getMaxPageWidth(c, PAGE_PAINTING_CLEARANCE),                root.getLastPage().getPaintingBottom() + PAGE_PAINTING_CLEARANCE));        revalidate();        Graphics2D g = c.getGraphics();        Shape working = g.getClip();        List pages = root.getPages();        for (int i = 0; i < pages.size(); i++) {            PageBox page = (PageBox)pages.get(i);            g.setClip(working);                        Rectangle overall = page.getOverallPaintingBounds(c, PAGE_PAINTING_CLEARANCE);            overall.x -= 1;            overall.y -= 1;            overall.width += 1;            overall.height += 1;            if (working.intersects(overall)) {                Color old = g.getColor();                                g.setColor(Color.BLACK);                g.drawRect(overall.x, overall.y, overall.width, overall.height);                g.setColor(old);                                Rectangle content = page.getContentClippingBounds(c, PAGE_PAINTING_CLEARANCE);                g.clip(content);                                int left = PAGE_PAINTING_CLEARANCE +                    page.getStyle().getMarginBorderPadding(c, CalculatedStyle.LEFT);                int top = page.getPaintingTop()                     + page.getStyle().getMarginBorderPadding(c, CalculatedStyle.TOP)                    - page.getTop();                                g.translate(left, top);                root.paint(c, 0, 0);                g.translate(-left, -top);                                g.setClip(working);                page.paintAlternateFlows(c, root, PAGE_PAINTING_CLEARANCE);                                page.paintBorder(c, PAGE_PAINTING_CLEARANCE);            }         }                g.setClip(working);    }