Java Gradient Paint alpha not working
<p>I am trying to use GradientPaint functionality, but the Alpha value is not seeming to work.</p>

<p>The whole image is just simply the same color and no alpha variation at all can be seen:</p>

<p>Relevant pieces of code:</p>

<pre><code>    bufferedImage = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().createCompatibleImage(CARD_DIMENSION.width,  CARD_DIMENSION.height, Transparency.TRANSLUCENT);
    final Graphics2D g2d = (Graphics2D)bufferedImage.createGraphics();
    //...
    drawRectangle(g2d, CARD_DIMENSION.width, CARD_DIMENSION.height, 0, 0, 10, card.getColor());
</code></pre>

<p>and</p>

<pre><code>private void drawRectangle(final Graphics2D g2d, int width, int height, int x, int y, final int borderSize, final Color color) {        
    g2d.setColor(color);
    g2d.fillRect(x, y, width, height);

    //account for border distance
    x += borderSize;
    y += borderSize;
    width -= 2 * borderSize;
    height -= 2 * borderSize;

    int mx = (int)Math.round(x + (width / 2));
    int my = (int)Math.round(y + (height / 2));   

    Color colorEdge = color;
    //Color colorInside = alphaColor(blendColor(color, Color.WHITE), 128);
    Color colorInside = alphaColor(color, 128);

    GradientPaint paintQ1 = new GradientPaint(x, y, colorEdge, mx, my, colorInside);
    g2d.setPaint(paintQ1);
    g2d.fillRect(x, y, mx - x, my - y);

    GradientPaint paintQ2 = new GradientPaint(x + width - 1, y, colorEdge, mx, my, colorInside);
    g2d.setPaint(paintQ2);
    g2d.fillRect(mx, y, mx - x, my - y);

    GradientPaint paintQ3 = new GradientPaint(x, y + height - 1, colorEdge, mx, my, colorInside);
    g2d.setPaint(paintQ3);
    g2d.fillRect(x, my, mx - x, my - y);

    GradientPaint paintQ4 = new GradientPaint(x + width - 1, y + height - 1, colorEdge, mx, my, colorInside);
    g2d.setPaint(paintQ4);
    g2d.fillRect(mx, my, mx - x, my - y);
}

private Color alphaColor(final Color c1, final int alpha) {
    return new Color(c1.getRed(), c1.getGreen(), c1.getBlue(), alpha);
}
</code></pre>

<p>I don't see where the problem would be.</p>

<p>For example if I set color = Color.RED, then the image is just fully red without any sign of alpha at all.</p>

<p>Hopefully anyone knows why this is happening, as my colorInside clearly has alpha on 128.</p>

<p>I also tried with explicitely:</p>

<pre><code>    Color colorEdge = alphaColor(color, 0);
</code></pre>

<p>But it neither works.</p>

<p>Any help is appreciated.</p>

<p><strong>Edit: Added (useless) graphic info on request.</strong></p>

<p><img src="http://img577.imageshack.us/img577/725/tcg9.jpg" alt="useless graphic"></p>

<p>As describined multiple times in OP it is all the same color.</p>
