Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Java in General
menu not showing up on gui window
Bud Tippins
Ranch Hand
Posts: 52
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Here is the code that I have related to the menu. The menu is just not showing up on the window. What am I missing? Thank you for your help.
JMenuBar menuBar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); JMenuItem restoreMenuItem = new JMenuItem("Restore"); JMenuItem saveMenuItem = new JMenuItem("Save"); restoreMenuItem.addActionListener(new RestoreMenuListener()); saveMenuItem.addActionListener(new SaveMenuListener()); fileMenu.add(saveMenuItem); fileMenu.add(restoreMenuItem); menuBar.add(fileMenu); theFrame.setJMenuBar(menuBar);
Ralph Cook
Ranch Hand
Posts: 479
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Looks all right to me. Are you executing this outside the UI update
thread
, perhaps?
rc
Rob Camick
Rancher
Posts: 3324
32
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Here is the code that I have related to the menu.
We don't know where/when this code is invoked. Post your
SSCCE
that demonstrates the problem.
Bud Tippins
Ranch Hand
Posts: 52
posted 13 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Ralph,
That was the problem. I had the Menu setup after
theFrame.setVisible(true);
I moved it to before and it is now working.Thanks for your help.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Creating one class from another
JMenu Problem
Why is this code taking too long to launch
How come this isn't working anymore?
JFrame and JMenu
More...