public BufferedImage drawToBufferedImage(){
  final BufferedImage bufImg=new BufferedImage(getIconWidth(),getIconHeight(),BufferedImage.TYPE_INT_ARGB);
  final Graphics g=bufImg.getGraphics();
  paintIcon(null,g,0,0);
  g.dispose();
  return bufImg;
}

public BufferedImage drawToBufferedImage ( ) { final BufferedImage bufImg = new BufferedImage ( getIconWidth ( ) , getIconHeight ( ) , BufferedImage . TYPE_INT_ARGB ) ; final Graphics g = bufImg . getGraphics ( ) ; paintIcon ( null , g , 0 , 0 ) ; g . dispose ( ) ; return bufImg ; }
draws the form to a bufferedimage the size of the icon and returns it , uses the painticon method for the drawing so future changes should only be in one place
