private JLabel createIconLabel(JCheckBox checkBox){
  checkBox.setOpaque(false);
  checkBox.setSize(checkBox.getMinimumSize());
  Image image=new BufferedImage(checkBox.getWidth(),checkBox.getHeight(),Transparency.TRANSLUCENT);
  Graphics g=image.getGraphics();
  checkBox.paint(g);
  g.dispose();
  return new JLabel(new ImageIcon(image));
}

private JLabel createIconLabel ( JCheckBox checkBox ) { checkBox . setOpaque ( false ) ; checkBox . setSize ( checkBox . getMinimumSize ( ) ) ; Image image = new BufferedImage ( checkBox . getWidth ( ) , checkBox . getHeight ( ) , Transparency . TRANSLUCENT ) ; Graphics g = image . getGraphics ( ) ; checkBox . paint ( g ) ; g . dispose ( ) ; return new JLabel ( new ImageIcon ( image ) ) ; }
creates an image of the checkbox and puts it in a label .
