Stroking or Filling a Shape

A stroked shape is an outline of the shape. A filled shape is drawn with filled with a color. See also The Quintessential Drawing Program.
public void paint(Graphics g) { Graphics2D g2d = (Graphics2D)g; // Set pen color for stroked shape g2d.setColor(Color.red); // Stroke the shape g2d.draw(shape); // Set fill color for filled shape g2d.setColor(Color.blue); // Fill the shape g2d.fill(shape); }

Post a comment

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.