Skip to content

Instantly share code, notes, and snippets.

@tsuoanttila
Last active February 14, 2017 12:16
Show Gist options
  • Save tsuoanttila/5179da30b5a6436a13b0ee9c7020eae9 to your computer and use it in GitHub Desktop.
Save tsuoanttila/5179da30b5a6436a13b0ee9c7020eae9 to your computer and use it in GitHub Desktop.
Password field in window
VerticalLayout layout = new VerticalLayout();
usernameField = new TextField("Username:");
layout.addComponent(usernameField);
passwordField = new PasswordField("Password:");
layout.addComponent(passwordField);
Button login = new Button("Login");
login.setClickShortcut(KeyCode.ENTER, null);
login.addClickListener(e -> Notification.show(
usernameField.getValue() + ":" + passwordField.getValue()));
layout.addComponent(login);
Window window = new Window();
window.setContent(layout);
addWindow(window);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment