From d122c0a5ed60763242f8f560bc92747db03db88a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sun, 25 Sep 2011 12:59:04 +0200 Subject: anonymous button event listener --- vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java b/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java index 2a85bc4..455cbfb 100644 --- a/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java +++ b/vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java @@ -1,8 +1,12 @@ package ch.asynk.helloworld; +import java.util.Date; + import com.vaadin.Application; import com.vaadin.ui.Window; import com.vaadin.ui.Label; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; public class HelloWorldApp extends Application { @@ -14,6 +18,14 @@ public class HelloWorldApp extends Application { final Window mainWindow = new Window("Hello World Application"); Label label = new Label("Hello world"); mainWindow.addComponent(label); + // + mainWindow.addComponent( new Button("What is the time?", new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + mainWindow.showNotification("The time is " + new Date()); + } + })); + // setMainWindow(mainWindow); } } -- cgit v1.1-2-g2b99