Click here to Skip to main content
15,887,325 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
After reading two chapters i am clueless as to where the actionPerformed method should go, in one book i see it in a private inner class, inside a public class(which creates a frame). In the other book i see it right after the listener is registered using @override. Hopefully i am clear enough, otherwise i can give examples.

i one one book i see:
button.addActionListener(new ActionListner(){
@override
public void actionPerformed(ActionEvent e){
//code
//
}
});
----------------------------------------
in the other:
button.addActionListener(new CalcButtonListen())
//
//
//then at the end of the class, a private class is created

private class CalcButtonListen implements ActionLIstener{
public void actionPerformed(ActionEvent e){
//code
//
}
}
Posted
Updated 4-Oct-14 10:56am
v5
Comments
Sergey Alexandrovich Kryukov 4-Oct-14 16:36pm    
Are you sure you mean ActionEventListener, not ActionListener?
The question has been edited...
—SA

1 solution

 
Share this answer
 
Comments
jchacon28 4-Oct-14 16:58pm    
the link cleared it out for me, thank you
Sergey Alexandrovich Kryukov 4-Oct-14 18:57pm    
You are welcome.
Good luck, call again.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900