Code Samples Index
These code examples and other materials are subject to Sun Microsystems, Inc. Legal Terms
Stroking or Filling with a Gradient Color
Color startColor = Color.red; Color endColor = Color.blue; // A non-cyclic gradient GradientPaint gradient = new GradientPaint( startX, startY, startColor, endX, endY, endColor); g2d.setPaint(gradient); drawShape(g2d); // A cyclic gradient gradient = new GradientPaint( startX, startY, startColor, endX, endY, endColor, true); g2d.setPaint(gradient); drawShape(g2d);
Examplets provided by permission of the publisher, Addision-Wesley, and Author Patrick Chan. Order this book from Amazon