When defining the behaviour of a simple click on a JButton, which is the right way to do it? And, what\'s the difference?
JButton but = new JButton();
but.ad
If you want to do something when a Jbutton is clicked, action listener is better because mouse listener does not recognize that a mouse is clicked on a button if a user presses the mouse on a JButton and then moves the mouse a little bit before releasing the mouse button while remaining within the button the whole time, but action listener does. MouseListener requires that mouse clicks have no movement between mouse press and mouse release, which is not the case for my users.