• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Iterating the EventQueue

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem I am having is about JTree.
I have a MouseListener on the tree.
When user single-clicks on a node, the program will perform some tasks.
When user double-clicks, the program will just expand/collapse the node, but not perform the tasks.
The problem is when double-click, the MouseClicked will be called twice.
Like this:
MouseClicked(...) //with e.getClickCount = 1
MouseClicked(...) //with e.getClickCount = 2
The task will be performed twice and the node will be expanded if it is double-click. Is there a way to find out if it is a double-click with e.getClickCount() is still 1?
I know the peekEvent only return the first event.
Is there a way to get all the event pending in the event queue? So, if there is a MouseClick event with clickcount > 1, then the program will just skip the task?
Like this:

I hope you know what I want.
Thank you
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic