Hi all.

Im having trouble getting my menu to work on my window.
this is what I have so far as for my code.

package sparepartinventory;
import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.*;

/**
 *
 * @author jonathan
 */
public class SparePartInventory {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

        //Getting screen size
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    double width = screenSize.getWidth();
    double height = screenSize.getHeight();


        //Creating a window for the program

        JFrame Window = new JFrame();
        Window.setVisible(true);
    Window.setTitle("Spare Part Inventory");
    Window.setSize((int)width,(int)height);
        Window.setResizable(true);
    Window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);


    }

    public void Menuforwindow()
    {




    JMenuBar MenuBar;
    JMenu menu;
    JMenuItem MenuItem;
    MenuBar = new JMenuBar ();
    setJMenuBar (MenuBar);

    //adding menu
    menu = new JMenu ("File");
    MenuBar.add (menu);

    MenuItem = new JMenuItem ("Settings");

    menu.add (MenuItem);

    MenuItem = new JMenuItem ("Quit");

    menu.add (MenuItem);

    menu = new JMenu ("Help");
    MenuBar.add (menu);

    MenuItem = new JMenuItem ("Instructions");

    menu.add (MenuItem);

    MenuItem = new JMenuItem ("About Spare Part Inventory");
        JMenuItem add = menu.add (MenuItem);
    }
    }




}

For some reason The menu items wont show?, Im getting errors but i dont know what they are. Im using netbeans. please help me!!!!:)

Edited 2 Years Ago by scheppy

This question has already been answered. Start a new discussion instead.