Default behavior for Swing components, like JButton is to use its UI delegate to paint the component. The UI delegate is determined by the look-and-feel. The look-and-feel may ignore calls to method setBackground(). Hence if you want to change the background color you need to either adjust the look-and-feel or override the painting code used by class JButton.
As you can see, the Metal look-and-feel honors calls to method setBackground() whereas Nimbus does not.
We cannot change unless we survive, but we will not survive unless we change. Evolving tiny ad:
how do I do my own kindle-like thing - without amazon