poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + border.top - adjust); poly.addPoint(bounds.x + leftCorner, bounds.y + border.top - adjust);
poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + (int)border.top() - adjust); poly.addPoint(bounds.x + leftCorner, bounds.y + (int)border.top() - adjust);
    private static Polygon getBevelledPolygon(final Rectangle bounds, final Border border, final int sides, int currentSide, boolean isClipRegion) {        //adjust for bug in polygon filling        final int adjust;        //adjust inside corners to make sides fit snugly        final int snuggle;        if (isClipRegion) {            adjust = 0;            snuggle = 1;        } else {            adjust = 1;            snuggle = 0;        }        int rightCorner = (((sides & RIGHT) == RIGHT) ? border.right : adjust);        int leftCorner = (((sides & LEFT) == LEFT) ? border.left - adjust : 0);        int topCorner = (((sides & TOP) == TOP) ? border.top - adjust : 0);        int bottomCorner = (((sides & BOTTOM) == BOTTOM) ? border.bottom : adjust);        Polygon poly = null;        if (currentSide == TOP) {            if (border.top != 1) {                // use polygons for borders over 1px wide                poly = new Polygon();                poly.addPoint(bounds.x, bounds.y);                poly.addPoint(bounds.x + bounds.width - adjust, bounds.y);                poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + border.top - adjust);                poly.addPoint(bounds.x + leftCorner, bounds.y + border.top - adjust);            }        } else if (currentSide == BOTTOM) {            if (border.bottom != 1) {                poly = new Polygon();                // upper right                poly.addPoint(bounds.x + bounds.width - rightCorner, bounds.y + bounds.height - border.bottom);                // upper left                poly.addPoint(bounds.x + leftCorner, bounds.y + bounds.height - border.bottom);                // lower left                poly.addPoint(bounds.x, bounds.y + bounds.height - adjust);                // lower right                poly.addPoint(bounds.x + bounds.width - adjust, bounds.y + bounds.height - adjust);            }        } else if (currentSide == RIGHT) {            if (border.right != 1) {                poly = new Polygon();                poly.addPoint(bounds.x + bounds.width - adjust, bounds.y);                poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + topCorner - snuggle);                poly.addPoint(bounds.x + bounds.width - border.right, bounds.y + bounds.height - bottomCorner + snuggle);                poly.addPoint(bounds.x + bounds.width - adjust, bounds.y + bounds.height - adjust);            }        } else if (currentSide == LEFT) {            if (border.left != 1) {                poly = new Polygon();                poly.addPoint(bounds.x, bounds.y);                poly.addPoint(bounds.x + border.left - adjust, bounds.y + topCorner - snuggle);                poly.addPoint(bounds.x + border.left - adjust, bounds.y + bounds.height - bottomCorner + snuggle);                poly.addPoint(bounds.x, bounds.y + bounds.height - adjust);            }        }        return poly;    }