An object does not "have a name". A variable has a name, and a variable has a reference to an object.
So you are asking how to get the name of the variable that you defined to hold a reference to that JMenuItem (I think).
Of course the getSource() method returns a reference to the object itself, not any of the
multiple variables that might be referencing it. However, once you know the object that sent the event, you can compare to see if it is the SAME object that is referenced in one of your variables.
Which addresses your question, but leaves the issue of WHY do you want to do this? If you have a separate listener for each JMenuItem,
you should not NEED to do such a compare. Or is there some OTHER reason?
[This message has been edited by Cindy Glass (edited August 30, 2001).]