Draw the example
// Set basic drawing attributes
g.setFont(new Font("SansSerif", Font.PLAIN, 10)); // select font
g.setStroke(new BasicStroke(2.0f)); // 2 pixel lines
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, // antialiasing
RenderingHints.VALUE_ANTIALIAS_ON);
g.translate(10, 10); // margins
// Loop through each shape
for(int i = 0; i < shapes.length; i++) {
g.setColor(Color.yellow); // Set a color
g.fill(shapes[i]); // Fill the shape with it
g.setColor(Color.black); // Switch to black
g.draw(shapes[i]); // Outline the shape with it
g.drawString(labels[i], 0, 110); // Label the shape
g.translate(120, 0); // Move over for next shape
if (i % 6 == 5) g.translate(-6*120, 120); // Move down after 6
}