private ImageIcon addSpaceToIcon(ImageIcon icon){
  int width=icon.getIconWidth();
  int height=icon.getIconHeight();
  int hspace=3;
  BufferedImage res=new BufferedImage(width + hspace,height,BufferedImage.TYPE_INT_ARGB);
  Graphics g=res.getGraphics();
  g.drawImage(icon.getImage(),0,0,null);
  g.dispose();
  return new ImageIcon(res);
}

private ImageIcon addSpaceToIcon ( ImageIcon icon ) { int width = icon . getIconWidth ( ) ; int height = icon . getIconHeight ( ) ; int hspace = 3 ; BufferedImage res = new BufferedImage ( width + hspace , height , BufferedImage . TYPE_INT_ARGB ) ; Graphics g = res . getGraphics ( ) ; g . drawImage ( icon . getImage ( ) , 0 , 0 , null ) ; g . dispose ( ) ; return new ImageIcon ( res ) ; }
creates a new imageicon based on the given imageicon that has a small space on the side , so it can be displayed properly .
