Time for action – adding click listeners
Follow these steps to allow a VerticalLayout
listen to click events:
Once again, add the highlighted code to your each time bigger (and it will grow more, you can tell)
LayoutFrameworkUI
class:public class LayoutFrameworkUI extends UI { protected void init(VaadinRequest request) { ... layout.addMenuOption("Click listener", getClickListener()); } ... private Component getClickListener() { VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); layout.addLayoutClickListener(new LayoutClickListener() { public void layoutClick(LayoutClickEvent event) { String message = "And you did it at " + event.getClientX() + ", " + event.getClientY(); Notification.show("You clicked me!", message, Type.TRAY_NOTIFICATION); } }); return layout; } }
Run the application, click on Click listener, and perform some clicks over the invisible
VerticalLayout...