• Post Reply Bookmark Topic Watch Topic
  • New Topic

Dynamically changing a JMenuBar  RSS feed

 
Christian Waidner
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!