Change Icon of Unchecked CheckBoxMenuItem

695 Views Asked by At

I'm trying to change the Icon of a CheckBoxMenuItem with the Nimbus Look&Feel.

    UIManager.put("CheckBoxMenuItem[Selected].checkIcon", new ImageIcon(getClass().getResource("/packagename/images/unchecked-icon.png")));

This works fine for the selected Checkbox, but what is the state of an unselected Box?

1

There are 1 best solutions below

0
On

It works. Just had to use the right order!

UIManager.put("CheckBoxMenuItem.checkIcon", new ImageIcon(getClass().getResource("/package/images/unchecked.png")));
UIManager.put("CheckBoxMenuItem[Selected].checkIcon", new ImageIcon(getClass().getResource("/package/images/checked.png")));