title: ImageIcon does not show up for a checkbox
body: <p>I want to add an icon instead of default square box of a check box. Whenever i add icon the only checkbox label views, no icon or default square box shows up. Why icon is not viewed.. I have searched a lot.. but nothing works for me
  Here is the code..</p>
  
  <pre><code>import java.awt.event.ItemListener;
  import java.awt.*;
  import java.awt.event.*;
  import javax.swing.*;
  import javax.swing.ImageIcon;
  public class againcheckbox extends  JFrame implements ItemListener
  {
      //frame and panel
      ImageIcon image1=new ImageIcon("logo4.png");
      JFrame frame=new JFrame();
      JPanel panel=new JPanel();
      JCheckBox c1=new JCheckBox("College");
      JCheckBox c2=new JCheckBox("University");
      JCheckBox c3=new JCheckBox("Both");
      JLabel l1=new JLabel();
      public againcheckbox()
      {
          panel.add(c1);
          panel.add(c2);
          panel.add(c3);
          panel.add(l1);
          c1.setIcon(image1);
          c2.setIcon(image1);
          c3.setIcon(image1);
          c1.addItemListener(this);
          c2.addItemListener(this);
          c3.addItemListener(this);
          panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),"select"));
          frame.add(panel);
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setPreferredSize(new Dimension(200,200));
          frame.pack();
          frame.setVisible(true);
      }
      public void itemStateChanged(ItemEvent e)
      {
          JCheckBox test=(JCheckBox) e.getItem();
          String str=test.getText();
          l1.setText(str);
      }
      public static void main(String args[])
      {
          againcheckbox acb=new againcheckbox();
      }
  }
  </code></pre>