FileDocCategorySizeDatePackage
GradientFill.javaAPI DocExample663Sat Jun 24 20:09:46 BST 2000None

GradientFill

public class GradientFill extends Component
Fill a Polygon with a colored gradient

Fields Summary
Polygon
p
The points we draw
GradientPaint
gp
The gradient we paint with
Constructors Summary
public GradientFill()
Construct the drawing object

		p = new Polygon();
		// make a triangle.
		p.addPoint(0,100);
		p.addPoint(200,0);
		p.addPoint(200,200);
	
Methods Summary
public java.awt.DimensiongetPreferredSize()

		return new Dimension(210, 210);
	
public voidpaint(java.awt.Graphics g)

		Graphics2D g2 = (Graphics2D)g;
		g2.draw(p);
		gp = new GradientPaint(50.0f, 50.0f, Color.red,
			75.0f, 75.0f, Color.green, true);
		g2.setPaint(gp);
		g2.fill(p);