What is the difference of use between mouseClicked and actionPerformed?

7

What's the difference between these two events: mouseClicked () and actionPerformed ()? What differs in your execution and when will they run?

    
asked by anonymous 13.06.2017 / 21:16

2 answers

2

The event mouseClicked() is part of MouseListener Interface , "listener" interface for events related to the mouse and controls the events of it. This "listener" is called when the mouse button was clicked (pressed and released) on a component.

The event actionPerformed() is part of the ActionListener Interface , the "listener" interface of action events and defined actions of a component. This "listener" is usually called when an action occurs.

Related

02.10.2017 / 15:56
5

ActionPerformed will respond when the button is triggered, either by mouse or keyboard, MouseClicked will only notify when the mouse is used.

Source: Difference between MouseClicked and ActionPerformed?

    
13.06.2017 / 21:23