How to detect double-click mouse events in Swing?



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



.