I am learning Java and would really like to have a deeper understanding of what the ActionEvent e perameter means and stands for. When I code I don't just want to spit out lines that work, but I don't understand. I want to have a full understanding of concepts before I use them.
So what specifically is it asking for and what do the two parts(ActionEvent and e) mean?
class ButtonListener implements ActionListener{
@Override
public void actionPerformed(ActionEvent e){
}
}
Thanks.
ActionEvent
is a class, e
is an instance of that class. You can use e to call it's methods/properties, found here
http://docs.oracle.com/javase/7/docs/api/java/awt/event/ActionEvent.html
ActionEvent
is just a type, it informs you what type of object e
is. By the way, you can change e
to whatever you prefer, for ex. event
or object
.
ActionEvent event
, ActionEvent object
(remember, not to be confused with Object
, its object with lower case "o"), ActionEvent anyVariableName
etc...
Then inside actionPerformed()
you can call stuff like event.doSomething();