Java Code
import java.awt.*;
import java.awt.geom.*;
import javax.swing.*;
public class Graphics2DStroke2 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(50, 75, Color.yellow, 95, 95, Color.blue, true);
g2.setPaint ( gp ); // fill with gradient
// Stroke
float strokeThickness = 5.0f;
BasicStroke stroke = new BasicStroke(strokeThickness);
Shape newShape = stroke.createStrokedShape(ellipse);
g2.draw( newShape );
}
}
©2007-
by E.S.Boese. All Rights Reserved