Not able to display icon with JCheckBox
So this is a snippet code I am using:
class BarPanel extends JPanel {
URL iconURL = Test.class.getResource("caper.jpg");
ImageIcon caper = new ImageIcon(iconURL);
JCheckBox check1 = new JCheckBox("Check 1", caper,true);
public BarPanel() {
setLayout(new FlowLayout());
add(check1);
}
}
The image shows up fine but I can't see a checkbox, only the image icon with the Label. If I define the JCheckBox instance without an icon, the checkbox appears just fine.
Any help would be appreciated.