Question

I need in my own AWT EventQueue filtering mouse double clicks, so I do:

public class AppEventQueue extends EventQueue
{
@Override
protected void dispatchEvent(AWTEvent event)
{
    super.dispatchEvent(event);
    if(event instanceof MouseEvent)
    {
        MouseEvent mouseEvent = (MouseEvent) event;
        if(mouseEvent.getModifiers() == MouseEvent.MOUSE_CLICKED)
        {
            //do something
        }
    }
}
}

Problem I have is that it looks that click with mouse is generating int value 16, MouseEvent.MOUSE_CLICKED has value 500. Am I missing something?

Was it helpful?

Solution

you want to check the id:

if (mouseEvent.getID() == MouseEvent.MOUSE_CLICKED {

}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top