Enfim, o código completo do ExemploMenus fica assim:
package modulo1; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class ExemploMenus { /** * @param args * @throws UnsupportedLookAndFeelException * @throws IllegalAccessException * @throws InstantiationException * @throws ClassNotFoundException */ public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); JFrame frm = new JFrame("Exemplo de Menus"); FlowLayout flow = new FlowLayout(); frm.setLayout(flow); frm.setVisible(true); // Cria uma barra de menu para o JFrame JMenuBar menuBar = new JMenuBar(); // Adiciona a barra de menu ao frame frm.setJMenuBar(menuBar); // Define e adiciona dois menus drop down na barra de menus JMenu cadMenu = new JMenu("Cadastro"); menuBar.add(cadMenu); JMenu ajuMenu = new JMenu("Ajuda"); menuBar.add(ajuMenu); // Cria e adiciona um item simples para o menu JMenuItem newAction = new JMenuItem("Novo cadastro"); cadMenu.add(newAction); JMenuItem edAction = new JMenuItem("Editar cadastro"); cadMenu.add(edAction); JMenuItem sairAction = new JMenuItem("Sair"); cadMenu.addSeparator(); cadMenu.add(sairAction); JMenuItem sobAction = new JMenuItem("Sobre"); ajuMenu.add(sobAction); frm.setSize(650,200); //frm.pack(); frm.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e){ System.exit(0); } }); newAction.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ FormCadastro form = new FormCadastro(); form.setVisible(true); } }); edAction.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ FormCadastro form = new FormCadastro(); form.setVisible(true); } }); sairAction.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ System.exit(0); } }); sobAction.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ //FormCadastro form = new FormCadastro(); //form.setVisible(true); } }); } }