Reputation: 41
public void actionPerformed(ActionEvent actionEvent) { }
What does this line mean in detail, apart from that ActionEvent 's reference is being passed to actionPerformed method.
Upvotes: 0
Views: 322
Reputation: 7951
This method is part of ActionListener interface.
public class Listener implements ActionListener{
public static void main(String[] args) {
Listener listener = new Listener();
Button button = new Button();
button.addActionListener(listener);
}
public void actionPerformed(ActionEvent e) {
throw new UnsupportedOperationException("Not supported yet.");
}
}
When the user will press the button, the method actionPerformed of Listener class will be invoked.
Upvotes: 4
Reputation: 210623
public void actionPerformed(ActionEvent actionEvent) { }
public
: Method is accessible from any code.void
: Method doesn't return anything.actionPerformed
: Name of method.(
: You're beginning to specify the parameter list.ActionEvent
: Type of parameter #1.actionEvent
: Name of parameter #1.)
: You've finished specifying the parameter list.{ }
: Method doesn't do anything.Upvotes: 8