Help coderanch get a
new server
by contributing to the fundraiser
  • 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

Updating JMenuBar

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a JFrame with a JMenuBar. The main content of the JFrame is a JTabbedPane with several tabs. My goal is to adjust the JMenuBar according to the tab that has just been clicked on by the user. The problem is that the new JMenuBar is only displayed when I resize my JFrame.
I have a minimum sample that shows the problem:

At the beginning, A JMenuBar with a "Test"-JMenu is displayed. When the frame is not resized, the menu does not change... But when resizing the frame, the new Menus ("Test0", "Test1", ...) are displayed.
Does anybody know how to solve this problem?

Thanks in advance

Stefan
 
Stefan Krompass
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi again,

I solved the problem: JMenuBar#updateUI() was my friend...

bye

Stefan
 
Replace the word "snake" with "danger noodle" in all tiny ads.
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic