Hi,
I’m reading Book of Vaadin and got stuck on chapter 9. I tried to run following example:
package com.example.test;
import com.vaadin.Application;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.ui.*;
public class TestApplication extends Application {
@Override
public void init() {
final Window mainWindow = new Window("Test Application");
final TextField tf = new TextField("Name");
// Set the value
tf.setValue("The text field value");
// When the field value is edited by the user
tf.addListener(new Property.ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
// Get the value and cast it to proper type
String value = (String) tf.getValue();
// Do something with it
mainWindow.addComponent(new Label(value));
}
});
mainWindow.addComponent(tf);
setMainWindow(mainWindow);
}
}
Problem is, that after value change in text field nothing happens. Why? What should I change in this code?
regards,
Rob