How do I change the color of a disabled jToggleButton?

323 Views Asked by At

I'm working on a game that disables JToggleButton buttons when I click on them, but I want the buttons to also change color when they're disabled. I disable a button with:

private void jToggleButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    jToggleButton1.setEnabled(false);
}

I've tried using jToggleButton1.setBackground(Color.RED); before and after the jToggleButton1.setEnabled(false); but the button always turns gray anyway when it's disabled.

Does anybody know a solution?

0

There are 0 best solutions below