Hi guys,
I’ve been banging my head against this particular brick wall for a couple of days now… I’m trying to create a circle that fills itself from transparent at the centre to black at the edges using RadialGradientPaint but I just can’t get it to work!
Here’s what I’m using right now:
RadialGradientPaint whiteToBlack = new RadialGradientPaint(
50, // x centre
50, // y centre
50, // radius of fill
new float[] { 0.0f, 1.0f }, // start position of each color
new Color[] { new Color(1f, 1f, 1f, 0f), Color.BLACK }, // the colors
CycleMethod.NO_CYCLE
);
lightG.setPaint( whiteToBlack );
// draw in the centre of the screen, a 100x100 pixel oval
lightG.fillOval(this.width/2-50, this.height/2-50, 100, 100);
This is what it draws:
It seems to be completely ignoring the first color, I’ve tested with different colors and whichever is the second color I use, that’s the one that shows up.
Totally confused by it! ???
Any help gratefully received