I am trying to make it so that the button will change color whenever it is selected. I tried using an if statement to see if the button is selected, and if it is, it will set it to red. However it doesn't work.
if(jToggleButton1.isSelected()) {
jToggleButton1.setBackground(Color.RED);
}
If anyone can describe to me how to make me work that would be much appreciated.