summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/tests/book/TheButtons.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/vaadin/tests/book/TheButtons.java')
-rw-r--r--src/com/vaadin/tests/book/TheButtons.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/com/vaadin/tests/book/TheButtons.java b/src/com/vaadin/tests/book/TheButtons.java
new file mode 100644
index 0000000000..ed7ef00cc4
--- /dev/null
+++ b/src/com/vaadin/tests/book/TheButtons.java
@@ -0,0 +1,33 @@
+/*
+@ITMillApache2LicenseForJavaFiles@
+ */
+
+package com.vaadin.tests.book;
+
+import com.vaadin.ui.AbstractComponentContainer;
+import com.vaadin.ui.Button;
+
+public class TheButtons implements Button.ClickListener {
+ Button thebutton;
+ Button secondbutton;
+
+ /** Creates two buttons into given container. */
+ public TheButtons(AbstractComponentContainer container) {
+ thebutton = new Button("Do not push this button");
+ thebutton.addListener(this);
+ container.addComponent(thebutton);
+
+ secondbutton = new Button("I am a button too");
+ secondbutton.addListener(this);
+ container.addComponent(secondbutton);
+ }
+
+ /** Handle button click events from the two buttons. */
+ public void buttonClick(Button.ClickEvent event) {
+ if (event.getButton() == thebutton) {
+ thebutton.setCaption("Do not push this button again");
+ } else if (event.getButton() == secondbutton) {
+ secondbutton.setCaption("I am not a number");
+ }
+ }
+}