Java Code

import java.awt.*;
import java.awt.geom.*;
import javax.swing.*;
public class Graphics2DEx extends JApplet
{
	public void paint(Graphics g) 
	{
	    Graphics2D g2 = ( Graphics2D ) g;
	    int x = 15, y = 10, w = 50, h = 50;
	    Ellipse2D ellipse = new Ellipse2D.Double(x, y, w, h);
	    GradientPaint gp = new GradientPaint( x, y, Color.blue, w, h, Color.white, false);
	    g2.setPaint(gp);    		// fill with gradient
	    g2.fill(ellipse);
	}
}

©2007- by E.S.Boese. All Rights Reserved