buttonBar.add(new Button("Prompt", new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent ce) {
final MessageBox box = MessageBox.prompt("Name", "Please enter your name:");
box.addCallback(new Listener<MessageBoxEvent>() {
public void handleEvent(MessageBoxEvent be) {
Info.display("MessageBox", "You entered '{0}'", new Params(be.getValue()));
}
});
}
}));
buttonBar.add(new Button("Multiline Prompt", new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent ce) {
MessageBox box = MessageBox.prompt("Address", "Please enter your address:", true);
box.addCallback(new Listener<MessageBoxEvent>() {
public void handleEvent(MessageBoxEvent be) {
String v = Format.ellipse(be.getValue(), 80);
Info.display("MessageBox", "You entered '{0}'", new Params(v));
}
});
}
}));