Creating menus dynamically...is it possible?

Is it possible to have a menu on menubar say Edit...

when user clicks it, my program would decide what will the menuitems be. This could also be done by updating the menu all the time that it changes but program will be faster and easier to write if it's decided when user clicks it...

[306 byte] By [mikaelkuisma] at [2007-9-26 1:26:20]
# 1
please answer soon... my schedule is kind of thight!
mikaelkuisma at 2007-6-29 1:09:06 > top of Java-index,Archived Forums,Swing...
# 2

It is possible to add and remove menu items during program execution.

You can also add an menu listener to the menu to catch the user's click,

but the problem might be, that no one can say if your listener will be called

before the menu's own listener, which will show the popup window (the

menu items). So, if your listener is called first, you can add or remove

some items, but if the popup shows first, you might corrupt the menu.

Oliver

oliverd1 at 2007-6-29 1:09:06 > top of Java-index,Archived Forums,Swing...
# 3
Could you override from the JMenu and override the event dispatching somehow... I would need some professional advice on this though which methods to override..? Hope they aren't declared as final.
mikaelkuisma at 2007-6-29 1:09:06 > top of Java-index,Archived Forums,Swing...