In Java 2D you have frames (JFrame) and panels (JPanel). A frame represents the window. A frame contains panels. A panel can contain components (JComponent) and is also a component itself.
A Frame needs to be created to put panels on. This is done like so:
import javax.swing.*;