How to detect double-click mouse events in Swing?
- From: "Wes Harrison" <nospam@xxxxxxxx>
- Date: Fri, 30 Jun 2006 23:31:49 +1000
I think my understanding of mouse clicked events is wrong because I don't
get the behaviour I expect. When I implement the following code:
table.getTableHeader().addMouseListener(new MouseAdapter()
{
public void mouseClicked(MouseEvent event)
{
System.out.println("Mouse event, clickCount = " +
event.getClickCount());
}
}
I get the following output for every double-click:
Mouse event, clickCount = 1
Mouse event, clickCount = 2
Shouldn't it be just one event with a clickCount of 2? How can I tell the
difference between the first event and a normal single-click?
I am using Java 6.0 b89 but it probably applies to Java 5.0 and earlier as
well.
Thanks,
Wes
.
- Follow-Ups:
- Re: How to detect double-click mouse events in Swing?
- From: ducnbyu
- Re: How to detect double-click mouse events in Swing?
- From: Nuvious
- Re: How to detect double-click mouse events in Swing?
- Prev by Date: Re: AbstractAction
- Next by Date: JSplitPane/JScrollPane Problem?
- Previous by thread: help needed @ Taskbar dimensions (screen size- taskbar size)
- Next by thread: Re: How to detect double-click mouse events in Swing?
- Index(es):