What is the difference of use between mouseClicked and actionPerformed?

Asked

Viewed 298 times

7

What is the difference between these two events: mouseClicked() and actionPerformed()? What differs in their execution and when they will be executed?

2 answers

5

  • 1

    It was faster than me :D

2


The event mouseClicked() is part of the Interface Mouselistener, "listener" interface of events related to mouse and controls its events. This "listener" is called when the mouse button has been clicked (pressed and released) into a component.

The event actionPerformed() is part of the Interface Actionlistener, "listener" interface of action events and controller of the defined actions of a component. This "listener", in general lines, is called when an action occurs.

Related

Browser other questions tagged

You are not signed in. Login or sign up in order to post.