JFrame by default is BorderLayout. You want to add the painting JPanel to BorderLayout.CENTER.

JPanels default is FlowLayout so add all your components for user interaction to a JPanel and add...