import java.awt.BorderLayout; import java.awt.Dimension; import javax.swing.JFrame; public class MainFrame extends JFrame { private final static Dimension SIZE = new Dimension(900, 700); private DrawPanel panel = new DrawPanel(); public MainFrame() { setLayout(new BorderLayout()); add(panel, BorderLayout.CENTER); // add main menu MainMenu topMenu = new MainMenu(this, panel); setJMenuBar(topMenu); setPreferredSize(SIZE); setSize(SIZE); setResizable(true); setLocationRelativeTo(null); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); } public DrawPanel getDrawPanel() { return panel; } public static void main(String[] args) { new MainFrame(); } }