if (box.getBorderColor() == null) { box.setBorderColor(ctx.css.getStyle(box.getRealElement()).getBorderColor());
if (box.getBorderColor() == null) { box.border_color = ctx.css.getStyle(box.getRealElement()).getBorderColor();
    public void paint(Context ctx, Box box) {        //u.p("checking: " + box);        //u.p("hashcode = " + box.hashCode());        if (box.border == null) return;        Graphics g = ctx.getGraphics();        // TODO: color is per-side ((PWW 13/08/04))        //u.p("border = " + ctx.css.getBorderColor(box.getRealElement()).bottomColor);        box.border_color = ctx.css.getStyle(box.getRealElement()).getBorderColor().topColor;        if (box.getBorderColor() == null) {            box.setBorderColor(ctx.css.getStyle(box.getRealElement()).getBorderColor());        }        //u.p("set the border colors to: " + box.getBorderColor());        // ASK: border-style is a shorthand property for 4 border sides        // CSSBank/Accessor leave it as a single property, but XRStyleReference        // explodes it to individual values. Which way to go? (PWW 13/08/04)        if (box.border_style == null) {            box.border_style = ctx.css.getStyle(box.getRealElement()).getStringProperty(CSSName.BORDER_STYLE_TOP);        }        Rectangle bounds = new Rectangle(box.x + box.margin.left,                box.y + box.margin.top,                box.width - box.margin.left - box.margin.right,                box.height - box.margin.top - box.margin.bottom);        //u.p("box border style = " + box.border_style);        //u.p("border style = " + border_style);        if (box.border_style == null) {            box.border_style = "none";        }        // return if border = none        if (box.border_style.equals("none")) {            return;        }        if (box.border_style.equals("ridge") ||                box.border_style.equals("groove")) {            Border bd2 = new Border();            bd2.top = box.border.top / 2;            bd2.bottom = box.border.bottom / 2;            bd2.left = box.border.left / 2;            bd2.right = box.border.right / 2;            if (box.border_style.equals("ridge")) {                paintGoodBevel(g, bounds, box.border, box.getBorderColor().darker(), box.getBorderColor().brighter());                paintGoodBevel(g, bounds, bd2, box.getBorderColor().brighter(), box.getBorderColor().darker());            } else {                paintGoodBevel(g, bounds, box.border, box.getBorderColor().brighter(), box.getBorderColor().darker());                paintGoodBevel(g, bounds, bd2, box.getBorderColor().darker(), box.getBorderColor().brighter());            }            return;        }        if (box.border_style.equals("outset")) {            paintGoodBevel(g, bounds, box.border,                    box.getBorderColor().brighter(),                    box.getBorderColor().darker());            return;        }        if (box.border_style.equals("inset")) {            paintGoodBevel(g, bounds, box.border,                    box.getBorderColor().darker(),                    box.getBorderColor().brighter());            return;        }        if (box.border_style.equals("solid")) {            paintSolid(g, bounds, box.border, box.getBorderColor());        }        if (box.border_style.equals("double")) {            // this may need to be modified to account for rounding errors            // create a new border only 1/3 the thickness            Border outer = new Border();            outer.top = box.border.top / 3;            outer.bottom = box.border.bottom / 3;            outer.left = box.border.left / 3;            outer.right = box.border.right / 3;            Border center = new Border(outer);            Border inner = new Border(outer);            if (box.border.top == 1) {                outer.top = 1;                center.top = 0;            }            if (box.border.bottom == 1) {                outer.bottom = 1;                center.bottom = 0;            }            if (box.border.left == 1) {                outer.left = 1;                center.left = 0;            }            if (box.border.right == 1) {                outer.right = 1;                center.right = 0;            }            if (box.border.top == 2) {                outer.top = 1;                center.top = 0;                inner.top = 1;            }            if (box.border.bottom == 2) {                outer.bottom = 1;                center.bottom = 0;                inner.bottom = 1;            }            if (box.border.left == 2) {                outer.left = 1;                center.left = 0;                inner.left = 1;            }            if (box.border.right == 2) {                outer.right = 1;                center.right = 0;                inner.right = 1;            }            Rectangle b2 = shrinkRect(bounds, outer);            b2 = shrinkRect(b2, center);            // draw outer border            paintSolid((Graphics2D) g, bounds, outer, box.getBorderColor());            // draw inner border            paintSolid((Graphics2D) g, b2, inner, box.getBorderColor());        }        if (box.border_style.equals("dashed")) {            Graphics2D g2 = (Graphics2D) g;            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);            paintPatternedRect(g2, bounds, box.border, box.getBorderColor(), new float[]{10.0f, 4.0f});            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);        }        if (box.border_style.equals("dotted")) {            Graphics2D g2 = (Graphics2D) g;            // turn off anti-aliasing or the dots will be all blurry            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);            paintPatternedRect(g2, bounds, box.border, box.getBorderColor(), new float[]{box.border.top, box.border.top});            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);        }    }