Results 1 to 4 of 4

Thread: simple menu

  1. #1
    Gatsu is offline Member
    Join Date
    Dec 2012
    Posts
    42
    Rep Power
    0

    Default simple menu

    hi im making a simple menu in my application this way:

    Java Code:
    private void makeMenu()
        {
            JMenuBar menuBar;
            JMenu menuFile, menuHelp;
            JMenuItem file, help;
            
            menuBar = new JMenuBar();
            
            menuFile = new JMenu("Fil");
            file = new JMenuItem("Spara");
            menuFile.add(file);
            file = new JMenuItem("Avsluta");
            menuFile.add(file);
            
            menuHelp = new JMenu("Hjälp");
            help = new JMenuItem("Hjälpfil");
            menuHelp.add(help);
            
            mFrame.setJMenuBar(menuBar);
        }
    but it will only show a very small thing in the top, not a menu, are there something wrong with my code here?

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,773
    Blog Entries
    7
    Rep Power
    21

    Default Re: simple menu

    You should add menuFile and menuHelp to your menuBar.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    Gatsu is offline Member
    Join Date
    Dec 2012
    Posts
    42
    Rep Power
    0

    Default Re: simple menu

    oh yesss thanks!

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: simple menu

    Moved from New to Java

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. problems with simple roll down menu in java
    By Krtek80 in forum New To Java
    Replies: 5
    Last Post: 09-24-2012, 05:44 PM
  2. Creating a simple menu
    By hvince95 in forum New To Java
    Replies: 7
    Last Post: 01-20-2012, 08:07 AM
  3. Need some help with a simple menu.
    By Medabi3 in forum Java 2D
    Replies: 1
    Last Post: 04-04-2011, 06:21 AM
  4. Replies: 3
    Last Post: 08-07-2010, 06:28 AM
  5. Replies: 7
    Last Post: 05-09-2008, 08:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •