The JMenuItem
quitItem
has not been initialized anywhere, so an exception will be thrown before the JMenuBar
can be added to the JFrame
:
quitItem = new JMenuItem("Quit Game");
quitItem.addActionListener(...);
Aside: Avoid the use of absolute positioning (null
layout) and always use a layout manager.