public static ImageIcon createIconFromColor(final Color color,final Color borderColor,final int width,final int height,final Shape shape){
  BufferedImage img=new BufferedImage(width,height,BufferedImage.TYPE_INT_ARGB);
  Graphics2D g2=img.createGraphics();
  g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
  g2.setColor(color);
  g2.fill(shape);
  g2.setColor(borderColor);
  g2.draw(shape);
  g2.dispose();
  return new ImageIcon(img);
}

public static ImageIcon createIconFromColor ( final Color color , final Color borderColor , final int width , final int height , final Shape shape ) { BufferedImage img = new BufferedImage ( width , height , BufferedImage . TYPE_INT_ARGB ) ; Graphics2D g2 = img . createGraphics ( ) ; g2 . setRenderingHint ( RenderingHints . KEY_ANTIALIASING , RenderingHints . VALUE_ANTIALIAS_ON ) ; g2 . setColor ( color ) ; g2 . fill ( shape ) ; g2 . setColor ( borderColor ) ; g2 . draw ( shape ) ; g2 . dispose ( ) ; return new ImageIcon ( img ) ; }
creates an icon of the specified size and the given shape and colors .
