aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Iterating the EventQueue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Iterating the EventQueue " Watch "Iterating the EventQueue " New topic
Author

Iterating the EventQueue

Alex Ku
Ranch Hand

Joined: Jan 15, 2002
Posts: 47
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Iterating the EventQueue
 
Similar Threads
JTable question - URGENT
JTABLE's valuchanged method?
doubt in AWTEventMulticaster
How do I implement mouse double-click? - Urgent please..
SWT: how do differ between single and double click?