review2: ExtIcon example used to demonstrate the beauty of query pattern. two sections merged into one, a bit of reordering. Please review.
1 package org.apidesign.extensibleicon;
4 import java.awt.image.BufferedImage;
6 public class Icon2Image {
7 private Icon2Image() {}
9 // BEGIN: ext.icon2image
10 public static Image toImage(ExtIcon icon) {
11 Image img = icon.getLookup().lookup(Image.class);
15 BufferedImage buf = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_RGB);
16 icon.paintIcon(null, buf.getGraphics(), 0, 0);
19 // END: ext.icon2image