• 0

[Java] JMenuBar not appearing until window resized


Question

I'm taking my third class in Java. The last 3 weeks have been on GUI stuff (which I've never done before), and I can't figure this out.

//Create the menu bar.
        JMenuBar myJMenuBar = new JMenuBar();

        //Build the first menu.
        JMenu fileMenu = new JMenu("File");
        fileMenu.getAccessibleContext().setAccessibleDescription("The file menu.");
        myJMenuBar.add(fileMenu);

... I insert more menu items here, which probably aren't important ...

frame.setJMenuBar(myJMenuBar);

When I run the program, I see my JFrame, but the JMenuBar object doesn't show up until I resize the window. Any idea on why it isn't showing it initially?

8 answers to this question

Recommended Posts

  • 0
  Structured said:
that was it! I didn't really want to slam them all together, but it works and it isn't going to be graded for neatness. ;)~

thanks guys!

585038019[/snapback]

how did you repack the frame? just curious because im having EXACTLY the same problem with a java GUI im building for my uni courework :no:

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.