MouseListener is a low-level event listener in Swing (and AWT by the way).
ActionListener is a higher level and should be used.
Better than ActionListener , although you should use javax.swing.Action (which is actually an ActionListener ).
Using Action allows you to split it between multiple widgets (for example, JButton , JMenuItem ...); you not only use the code that starts when you press the button / menu, but also the sharing status, in particular, the fact of the inclusion or absence of an action (and related widgets).
jfpoilpret
source share