I'd like to expand on that subject. Since
Java 5.0 it's not necessary to use
getContentPane() for setting the layout and adding / removing components. These calls are automatically forwarded to the content pane. All other calls, like changing the background, should still be done using the content pane itself.
Before Java 5.0 you had to use
getContentPane() for everything; setting the layout or adding / removing components directly would cause an error.