Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Double click
Hi All,
I have the necessity to prevent DoubleClicks. Is there a way to prevent this for Button? I found the addListener for DoubleClickListener is not implemented in the class Button.
Thank you very much,
Ivan
I found MouseEvents.DoubleClickListener and I need to listen double click at a Label. How can I do it?
Wrap the label in a layout, so you can add a LayoutClickListener.
VerticalLayout wrap = new VerticalLayout();
wrap.addComponent(your_label);
wrap.addListener(new LayoutClickListener()
{
@Override
public void layoutClick(LayoutClickEvent event)
{
if (event.isDoubleClick()) {
//...
}
}
});
In what way do you need to prevent the double clicks?
The regular Button component doesn't react to it anyway, but if I assume correctly, you don't want two sequential click events happening, only one. You could probably use the Button.setDisableOnClick(boolean) method to disallow two sequential clicks on the same button. Then just re-enable the button in the click listener on the server, so that the button is active again once the request comes back from the server.