Whats the difference? When would you use a mouse listener? or a action listener? Please and Thank You!
ActionListener Doc's
The listener interface for receiving action events. The class that is interested in processing an action event implements this interface, and the object created with that class is registered with a component, using the component's
addActionListener
method. When the action event occurs, that object'sactionPerformed
method is invoked.
MouseListener Doc's
The listener interface for receiving "interesting" mouse events (press, release, click, enter, and exit) on a component. (To track mouse moves and mouse drags, use the
MouseMotionListener
.)
From the docs you can see that the usage of this interfaces is completly different. While you can use the MouseListener
only in combination with gui elements, the ActionListener
is also used when there is no gui, for example in combination with a timer.