/** Creates an image of the checkbox and puts it in a label. */
 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));
 }
Пример #2
0
 public void paint(Graphics g) {
   // if(!isPaintingForPrint()){ //works only in jre 1.6
   super.paint(g);
   // }
 }