Kevin had an interesting comment on my last blog that prompted me to write this note. First off, he gave me this suggestion to make it to work, which I think is cool.
JFrame frame = appContext.getFrame();
frame.setJMenuBar( newMenu );
Also, he asked why I am creating multiple menu bars instead of re-creating the menu items when switching contexts. I thought about it for a while and came to the following conclusion. If you switch contexts frequently, pre-creating menu bars and switching out would be beneficial, especially in scenarios where context switches need to happen on mouse overs. On the other hand, if you do context switches once in a while, it doesn’t hurt to re-create the menu items on demand.
As a side note, I create my menu items from an XML file, using Castor. If anyone is interested, I would be happy to share the code.