This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Dynamically changing a JMenuBar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Dynamically changing a JMenuBar" Watch "Dynamically changing a JMenuBar" New topic
Author

Dynamically changing a JMenuBar

Christian Waidner
Greenhorn

Joined: Mar 29, 2001
Posts: 6
Hi!
I have an applet running which displays a JMenuBar. I wonder if there is any way to change the menu while the application is running. I tried another call to the applet's setJMenuBar(mymenu) but then all menus just disappear.
I have not overridden any paint methods, so where's the problem?
Thanks in advance,
Chris


Christian Waidner<BR>Hirschbiegel & Grundstein GmbH<BR>http://www.hg-online.de
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
You were, of course, adding this JMenuBar to a JApplet, not a regular Applet? Maybe you could try:

before adding the new one. Then after it is added, you could also make a call to getMenuBar() just to see if it worked.
Christian Waidner
Greenhorn

Joined: Mar 29, 2001
Posts: 6
Hi!
Yep, JApplet.
I solved this problem 10 minutes ago. Seems to be the old Swing updating problem (grrrrrrr). Just invalidate every component except the last one, the validate and it's ok.
bye,
Chris
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Dynamically changing a JMenuBar
 
It's not a secret anymore!