diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-09-25 12:59:04 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-09-25 12:59:04 +0200 |
commit | d122c0a5ed60763242f8f560bc92747db03db88a (patch) | |
tree | dd5b75c5b21477422827a352cc2ffd3c0e22377a | |
parent | f3ba6a134f05cfb7faf8d7a3beb52fe64735f7cf (diff) | |
download | skeletons-d122c0a5ed60763242f8f560bc92747db03db88a.zip skeletons-d122c0a5ed60763242f8f560bc92747db03db88a.tar.gz |
anonymous button event listener
-rw-r--r-- | vaadin-app/src/ch/asynk/helloworld/HelloWorldApp.java | 12 |
1 files changed, 12 insertions, 0 deletions
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); } } |