I'm not sure if you did it on purpose or not.. but mouseDoubleClick is called 2 times when a triple click occurs.
I think it should be called only every 2 clicks. (so the second call should be done only on the 4rth click)
What do you think?

a component::mouseTripleClick() could be added as well.

I think this would be the proper way to intercept a triple click:

void MyComponent::mouseDown (const MouseEvent& e)
    if (e.getNumberOfClicks() == 3)
        // do something ...


Hi Timur. Actually I don't really care about getting the triple click, my concern is related to the doubleClick.

What annoys me is that when one does 3 clicks, mouseDoubleClick gets triggered 2 times, while I think it should only be triggered once.

I don't know if it is a bug, or if it is like that in juce on purpose, in which case I will just implement a workaround myself to ignore the second doubleClick

My guess is that this is on purpose - the second and third click taken together are also a valid double-click, aren't they? I would not consider this a bug. Besides, changing the behaviour would possibly break other people's code.

ok! thanks

I am having issues with mouseDoubleClick. It is triggering twice when I am 100% certain that I did a perfect doubleClick. That is, I clicked exactly two times: not three.
My app uses a doubleClick to create a new point on a graph plot. It is creating two points every time I double click. I am using logging and have verified this to be the case by careful testing.
For now, I am just going to create a workaround where I discard any duplicate points, but I wish there was a better way. This is not clean code.

This could also be due to adding something like addMouseListener(this, true) to the Component.

1 Like