If I have 5 JPanels with the same mouse adapter and I would like to determine which panel was clicked, how would I do that?
MouseEvent
is a subclass of ComponentEvent
, so:
http://download.oracle.com/javase/6/docs/api/java/awt/event/ComponentEvent.html#getComponent%28%29
getComponent
public Component getComponent()
Returns the originator of the event.
Returns: the Component object that originated the event, or null if the object is not a Component.