Frage

I have a swing application in which I want to use a JCheckbox with an icon. I constructed the icon as follows:

   JCheckBox unsubmit = new JCheckBox("Unsubmit",applet.undo);

When I do this, the label and the icon appear in my GUI but the box itself is no where to be found. If I construct the JCheckBox without the icon, the box comes back. I've tried adjusting the buttons's preferred size but it had no effect.

Anyone know what's going on here?

Thanks,

Elliott

War es hilfreich?

Lösung

The Icon is being used in place of the box. Consider creating a JCheckBox and a JLabel placed immediately next to each other, and have the JLabel hold the ImageIcon.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top