Creating an Icon(implement Icon interface) : Icon « Swing « 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) {

14.116.1.Creating an Icon(implement Icon interface)
14.116.2.State-Aware Icon DefinitionState-Aware Icon Definition
14.116.3.implements Icon, SwingConstants
14.116.4.Demonstrate the loading of image files into icons for use in a Swing user interface
14.116.5.An empty icon with arbitrary width and height.
14.116.6.An icon for painting a square swatch of a specified Color.
14.116.7.Arrow Icon
14.116.8.Creates a transparent icon.
14.116.9.Layered Icon