Hi,
I was just trying to improve one of my projects and it is turning into something nice.
I have a GUI and all of my events were handled there, with anonymous classes. Then I wondered if it is really the right one.
As far as I know, there are three basic event handling methods (At least for a beginner);
1- Anonymous classes,
buttonOne.addActionListener(new ActionListener(){ //implement the method }
2- Inner classes,
public class NotHandler{ //methods private class HandlerandInner extends MouseAdapter{ } }
3- A separate class.
public class One{ } public class Two implements MouseListener{ //methods etc. }
Can you guys explain me where to use every one of them? Or do you know an article or tutorial about this? I looked up for tutorials but they were just showing how to implement. I need to know where to implement
I know I can use every one of them in every situation, but in a specific situation, one should be more efficient than the others, right?