A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Simplest possible Left-Mouse-Button-Clicked event
Joined: Nov 14, 2011
May 05, 2012 16:52:54
I need a very simple event that activates anytime Left-Mouse-Button is clicked.
I'm looking at the mouse-listener
class. < Everything just looks overcomplicated for this small task.
Joined: Oct 27, 2005
May 05, 2012 17:21:48
like you already found out; perhaps you can extend
to help you with implementing the methods you don't need.
Check the event's button.
If it's button 1, do your dirty work.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions
How To Answer Questions
Joined: Jun 09, 2003
May 05, 2012 18:31:31
inside mousePressed or mouseReleased (mouseClicked doesn't always fire).
Joined: Oct 21, 2000
May 06, 2012 13:03:43
i agree, mousepressed() or mouseReleased() is usually what you want
I agree. Here's the link:
subject: Simplest possible Left-Mouse-Button-Clicked event
if MouseListener is added to component ..
Left mouse can not generate mouse clikced and released events??
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013