Draw the example
// Create the shape we'll work with. See convenience method below.
Shape pentagon = createRegularPolygon(5, 75);
// Set up basic drawing attributes
g.setColor(Color.black); // Draw in black
g.setStroke(new BasicStroke(1.0f)); // Use thin lines
g.setFont(new Font("SansSerif", Font.PLAIN, 12)); // Basic small font
g.translate(100, 100); // Move to position
g.draw(pentagon); // Outline the shape
g.drawString("The shape", -30, 90); // Draw the caption
g.translate(175, 0); // Move over
g.fill(pentagon); // Fill the shape
g.drawString("The filled shape", -50, 90); // Another caption
// Now use a Stroke object to create a "stroked shape" for our shape
BasicStroke wideline = new BasicStroke(10.0f);
Shape outline = wideline.createStrokedShape(pentagon);
g.translate(175, 0); // Move over
g.draw(outline); // Draw the stroked shape
g.drawString("A Stroke creates",-50,90); // Draw the caption
g.drawString("a new shape", -35, 105);
g.translate(175,0); // Move over
g.fill(outline); // Fill the stroked shape
g.drawString("Filling the new shape",-65,90); // Draw the caption
g.drawString("outlines the old one",-65,105);