Lenard van der Maas Lenard van der Maas -4 years ago 98
Java Question

how to change the background color of a J Checkbox inside the actual checkbox

How to change the color of the actual box of a

JCheckBox
?

If I change the background color, it affects the color behind the text and checkbox, but not the color of the box itself.

If I change the foreground color, only the text's color is affected.

I can't find any other color properties.

I just want a simple
JCheckBox
, with one color, which is changes when I check it.

Answer Source

I just want a simple JCheckBox, with 1 color, which is changeable when I check it.

There is no property you can set.

You need to provide custom Icons for the check box:

checkBox.setIcon( new ImageIcon(...") );
checkBox.setSelectedIcon( new ImageIcon(...) );
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download