If this code is called in the JFrame constructor, you do not change the color of the JPrame contentPane that must be executed. Make this call on the contentpane page:
getContentPane().setBackground(Color.WHITE);
Other JPanels added to the GUI should not have their own color set, but should have their opaque property set to false through myPanel.setOpaque(false); . This will allow you to see any image or color behind them. The exception is contentPane, which should always be opaque.
If this does not help, you need to tell us more (you need to do this anyway, since your question does not contain a lot of necessary and important information).
source share