Hi, On Java Standard MouseEvent, you could detect it is either single click or double click by using mouseEvent.getClickCount(). The threshold between click is determined by the JVM, which hopefully follows the platform it run (Win XP, linux, etc)
Regards Tonny Kohar -- Sketsa SVG Graphics Editor http://www.kiyut.com On Thu, 2006-04-20 at 23:49 +0100, Lewis Keen wrote: > Tim, > > During my final year project development (Poker game) I too noticed > the problem with double clicking on an element. I used this method on > my "click" event listeners: > > public boolean isSingleClick(Event evt) > { > MouseEvent me=(MouseEvent)evt; > return me.getDetail()==1; > } > > where the MouseEvent is a org.w3c.dom.events.MouseEvent and not a > standard java.awt.event.MouseEvent. This seemed to fix most of the > problems I was having, however this is still the odd occasion where it > does a double-click (not sure if its me or this dodgy mouse). I > consequently removed the flags that I was originally using and it > seemed to work fine. > > As to the two key listeners, it may be useful to have a brief > explanation of what the listeners do and if the affect each other in a > major way. I would imagine that the problem is similar to the problem > a double-click would have, and I did have some problems with the lock > not occuring quickly enough when doing a double-click. Sorry if this > is waffle, its a little hard to explain :/ > > Hope this helps, > > Lewis > > On 4/20/06, Tim Apessos <[EMAIL PROTECTED]> wrote: > > > > > > > > I took all the useful advice given to me on my SVG Update problem and fixed > > the problem that I was having. Thank you. I am curious about one other > > item. > > > > > > > > If I have two key listeners as in the example below and the user presses the > > keys nearly simultaneously, are there any thread safety issues that I need > > to worry about? As a precaution I've put flags in the listeners that I have > > written so far to prevent a double click while an update has not occurred > > but have not done so to prevent multiple keys from attempting to call the > > Update Manager at the same time. Is this an issue that I need to be > > concerned with? > > > > > > > > Public class KeyListener1{ > > > > . > > > > . > > > > . > > > > JSVGCanvas myCanvas; > > > > myCanvas.getUpdateManger().getUpdateRunnableQueue().invokeLater(new > > Runnable() { > > public void run() > > { > > performSVGUpdate1(); > > } > > }); > > } > > > > > > > > > > > > > > Public class KeyListener2{ > > > > JSVGCanvas myCanvas; > > > > myCanvas.getUpdateManger().getUpdateRunnableQueue().invokeLater(new > > Runnable() { > > public void run() > > { > > performSVGUpdate2(); > > } > > }); > > > > > > } > > > > > > > > Thanks, > > > > Tim > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
