import java.awt.Container; import javax.swing.JFrame; public class MainFrame extends JFrame { private final MainPanel panel; public MainFrame() { panel = new MainPanel(this); Container canvas = getContentPane(); canvas.add(panel); this.setSize(700, 400); this.setResizable(false); this.setLocationRelativeTo(null); this.setVisible(true); } public static void main(String[] args) { // TODO Auto-generated method stub new MainFrame().setDefaultCloseOperation(EXIT_ON_CLOSE); } }