Java tutorial
import java.awt.Color; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Ellipse2D; import javax.swing.JFrame; import javax.swing.JPanel; public class SimplestGradientPaint extends JPanel { public static void main(String[] args) { JFrame f = new JFrame(); f.getContentPane().add(new SimplestGradientPaint()); f.setSize(350, 250); f.show(); } public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; Ellipse2D e = new Ellipse2D.Float(40, 40, 120, 120); GradientPaint gp = new GradientPaint(75, 75, Color.white, 95, 95, Color.gray, true); g2.setPaint(gp); g2.fill(e); } }