How does one determine if an EventObject is a MouseEvent an ActionEvent or something else?
Is there a simple way to check the type of an EventObject?
How does one determine if an EventObject is a MouseEvent an ActionEvent or something else?
Is there a simple way to check the type of an EventObject?
You can use the instanceof keyword.
public boolean isActionEvent(EventObject o){
return o instanceof ActionEvent;
}
More info here: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/op2.html