Submenu

Report a typo

Following code tries to create a submenu for New menu item of File menu.

public void createMenuWithSubMenu(){
    JMenuBar menuBar = new JMenuBar();
    JMenu fileMenu = new JMenu("File");

    JMenuItem newMenuItem = new ___________("New");

    JMenuItem newFile = new JMenuItem("File");
    JMenuItem newFolder = new JMenuItem("Folder");

    newMenuItem.add(newFile);
    newMenuItem.add(newFolder);

    fileMenu.add(newMenuItem);
    menuBar.add(fileMenu);
    setJMenuBar(menuBar);

}

Enter the string that is missing.

Enter a short text
___

Create a free account to access the full topic