aspose file tools*
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
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 agree. Here's the link: http://aspose.com/file-tools
 
subject: Dynamically changing a JMenuBar
 
Similar Threads
Setting the null layout for JMenuBar in JApplet
MenuBar
JApplet containing JTextfields within a JMenubar
Run JApplet and no JMenuBar - Help!!
JMenuBar not using default alignment?