wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Updating JMenuBar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Updating JMenuBar" Watch "Updating JMenuBar" New topic

Updating JMenuBar

Stefan Krompass
Ranch Hand

Joined: Apr 29, 2004
Posts: 75

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 Krompass
Ranch Hand

Joined: Apr 29, 2004
Posts: 75
Hi again,

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


I agree. Here's the link: http://aspose.com/file-tools
subject: Updating JMenuBar
Similar Threads
setMnemonic: not visible on Windows native look and feel
Swing graphic problem
Add component above JFrame's menubar
How to add a shortkey to Menu
Swing Menu item with no children?