aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/demo/sampler/features/text/TextFieldInputPromptExample.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/itmill/toolkit/demo/sampler/features/text/TextFieldInputPromptExample.java')
-rw-r--r--src/com/itmill/toolkit/demo/sampler/features/text/TextFieldInputPromptExample.java49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/com/itmill/toolkit/demo/sampler/features/text/TextFieldInputPromptExample.java b/src/com/itmill/toolkit/demo/sampler/features/text/TextFieldInputPromptExample.java
new file mode 100644
index 0000000000..19f995044a
--- /dev/null
+++ b/src/com/itmill/toolkit/demo/sampler/features/text/TextFieldInputPromptExample.java
@@ -0,0 +1,49 @@
+package com.itmill.toolkit.demo.sampler.features.text;
+
+import com.itmill.toolkit.data.Property;
+import com.itmill.toolkit.data.Property.ValueChangeEvent;
+import com.itmill.toolkit.ui.TextField;
+import com.itmill.toolkit.ui.VerticalLayout;
+
+public class TextFieldInputPromptExample extends VerticalLayout implements
+ Property.ValueChangeListener {
+
+ public TextFieldInputPromptExample() {
+ // add som 'air' to the layout
+ setSpacing(true);
+ setMargin(true);
+
+ // Username field + input prompt
+ TextField username = new TextField();
+ username.setInputPrompt("Username");
+ // configure & add to layout
+ username.setImmediate(true);
+ username.addListener(this);
+ addComponent(username);
+
+ // Password field + input prompt
+ TextField password = new TextField();
+ password.setInputPrompt("Password");
+ // configure & add to layout
+ password.setSecret(true);
+ password.setImmediate(true);
+ password.addListener(this);
+ addComponent(password);
+
+ // Comment field + input prompt
+ TextField comment = new TextField();
+ comment.setInputPrompt("Comment");
+ // configure & add to layout
+ comment.setRows(3);
+ comment.setImmediate(true);
+ comment.addListener(this);
+ addComponent(comment);
+
+ }
+
+ public void valueChange(ValueChangeEvent event) {
+ getWindow().showNotification("Received " + event.getProperty());
+
+ }
+
+}