Java tutorial
import java.awt.Color; import java.awt.Component; import java.awt.Graphics; import java.awt.Polygon; import javax.swing.Icon; class DiamondIcon implements Icon { public DiamondIcon() { } public int getIconHeight() { return 20; } public int getIconWidth() { return 20; } public void paintIcon(Component c, Graphics g, int x, int y) { g.setColor(color); g.drawRect(0, 0, 20, 20); } }