F
Francois Lionet
Hi all,
Me again. I am working on menus right now. Menus in Java seems rather nice
and simple, but there is one thing I do not figure out : in my action
listener, how can I detect which menu option has been chosen? Under Windows,
it is simple as you have a menu identifier and you can check it. But I see
no such thing under Java and Swing. Should I keep a pointer to every
menuitem I have created and compare it to the object returned by getSource
in the action listener? Should I derive the JMenuItem class and add a menu
identifier of my own to manage this? Or is it a simpler way of proceeding?
How do you do this in your programs?
Thanks, Francois
Me again. I am working on menus right now. Menus in Java seems rather nice
and simple, but there is one thing I do not figure out : in my action
listener, how can I detect which menu option has been chosen? Under Windows,
it is simple as you have a menu identifier and you can check it. But I see
no such thing under Java and Swing. Should I keep a pointer to every
menuitem I have created and compare it to the object returned by getSource
in the action listener? Should I derive the JMenuItem class and add a menu
identifier of my own to manage this? Or is it a simpler way of proceeding?
How do you do this in your programs?
Thanks, Francois