Border outer = new Border(); outer.top = border.top / 3; outer.bottom = border.bottom / 3; outer.left = border.left / 3; outer.right = border.right / 3; Border center = new Border(outer);
BorderPropertySet outer = new BorderPropertySet( (int)(border.top() / 3), (int)(border.bottom() / 3), (int)(border.left() / 3), (int)(border.right() / 3)); BorderPropertySet center = new BorderPropertySet(outer);
    private static void paintBorderSide(final Border border, final Graphics g, final Rectangle bounds, final BorderColor border_color, final int sides, int currentSide, final IdentValue borderSideStyle, int xOffset) {        Graphics2D g2 = (Graphics2D) g;        if (borderSideStyle == IdentValue.RIDGE || borderSideStyle == IdentValue.GROOVE) {            Border bd2 = new Border();            bd2.top = border.top / 2;            bd2.bottom = border.bottom / 2;            bd2.left = border.left / 2;            bd2.right = border.right / 2;            if (borderSideStyle == IdentValue.RIDGE) {                paintGoodBevel(g2, bounds, border, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide);                paintGoodBevel(g2, bounds, bd2, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide);            } else {                paintGoodBevel(g2, bounds, border, border_color.brighter(borderSideStyle), border_color.darker(borderSideStyle), sides, currentSide);                paintGoodBevel(g2, bounds, bd2, border_color.darker(borderSideStyle), border_color.brighter(borderSideStyle), sides, currentSide);            }            return;        }        if (borderSideStyle == IdentValue.OUTSET) {            paintGoodBevel(g2, bounds, border,                    border_color.brighter(borderSideStyle),                    border_color.darker(borderSideStyle), sides, currentSide);            return;        }        if (borderSideStyle == IdentValue.INSET) {            paintGoodBevel(g2, bounds, border,                    border_color.darker(borderSideStyle),                    border_color.brighter(borderSideStyle), sides, currentSide);            return;        }        if (borderSideStyle == IdentValue.SOLID) {            paintSolid(g2, bounds, border, border_color, sides, currentSide);            return;        }        if (borderSideStyle == IdentValue.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 = border.top / 3;            outer.bottom = border.bottom / 3;            outer.left = border.left / 3;            outer.right = border.right / 3;            Border center = new Border(outer);            Border inner = new Border(outer);            if (border.top == 1) {                outer.top = 1;                center.top = 0;            }            if (border.bottom == 1) {                outer.bottom = 1;                center.bottom = 0;            }            if (border.left == 1) {                outer.left = 1;                center.left = 0;            }            if (border.right == 1) {                outer.right = 1;                center.right = 0;            }            if (border.top == 2) {                outer.top = 1;                center.top = 0;                inner.top = 1;            }            if (border.bottom == 2) {                outer.bottom = 1;                center.bottom = 0;                inner.bottom = 1;            }            if (border.left == 2) {                outer.left = 1;                center.left = 0;                inner.left = 1;            }            if (border.right == 2) {                outer.right = 1;                center.right = 0;                inner.right = 1;            }            Rectangle b2 = shrinkRect(bounds, outer, sides);            b2 = shrinkRect(b2, center, sides);            // draw outer border            paintSolid((Graphics2D) g, bounds, outer, border_color, sides, currentSide);            // draw inner border            paintSolid((Graphics2D) g, b2, inner, border_color, sides, currentSide);            return;        }        int thickness = 0;        if (currentSide == TOP) thickness = border.top;        if (currentSide == BOTTOM) thickness = border.bottom;        if (currentSide == RIGHT) thickness = border.right;        if (currentSide == LEFT) thickness = border.left;        if (borderSideStyle == IdentValue.DASHED) {            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);            paintPatternedRect(g2, bounds, border, border_color, new float[]{8.0f + thickness * 2, 4.0f + thickness}, sides, currentSide, xOffset);            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);        }        if (borderSideStyle == IdentValue.DOTTED) {            // turn off anti-aliasing or the dots will be all blurry            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);            paintPatternedRect(g2, bounds, border, border_color, new float[]{thickness, thickness}, sides, currentSide, xOffset);            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);        }    }