Anonymous Class

Anonymous Class


// Have a component that fires click events
Button button = new Button("Click Me!");
        
// Handle the events with an anonymous class
button.addListener(new Button.ClickListener() {
    public void buttonClick(ClickEvent event) {
        getWindow().showNotification("Thank You!");
    }
});
layout.addComponent(button);