Each top-level container has a content pane that, generally speaking, contains (directly or indirectly) the visible components in that top-level container's GUI.
For more info have a look Using Top-Level Containers
JFrame
is a top-level container and you can't set content pane to be null
.