private ImageIcon addColor(ImageIcon icon,Color color){
  if (icon == null || color == null) {
    return icon;
  }
  BufferedImage newImage=new BufferedImage(icon.getIconWidth(),icon.getIconWidth(),BufferedImage.TYPE_INT_ARGB);
  Graphics g=newImage.getGraphics();
  g.setColor(color);
  g.drawImage(icon.getImage(),0,0,color,null);
  g.dispose();
  return new ImageIcon(newImage);
}

private ImageIcon addColor ( ImageIcon icon , Color color ) { if ( icon == null || color == null ) { return icon ; } BufferedImage newImage = new BufferedImage ( icon . getIconWidth ( ) , icon . getIconWidth ( ) , BufferedImage . TYPE_INT_ARGB ) ; Graphics g = newImage . getGraphics ( ) ; g . setColor ( color ) ; g . drawImage ( icon . getImage ( ) , 0 , 0 , color , null ) ; g . dispose ( ) ; return new ImageIcon ( newImage ) ; }
adds a background color to the given icon , if an icon and color is actually given , otherwise the original icon is returned .
