-
Notifications
You must be signed in to change notification settings - Fork 0
/
LoginScreen.java
executable file
·29 lines (27 loc) · 1.02 KB
/
LoginScreen.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.beldon.apps.BeldonWorkbench;
import com.vaadin.event.ShortcutAction.KeyCode;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.FormLayout;
import com.vaadin.ui.PasswordField;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
@SuppressWarnings("serial")
public class LoginScreen extends VerticalLayout {
public LoginScreen() {
TextField username = new TextField("Username");
PasswordField password = new PasswordField("Password");
Button submit = new Button("Submit");
username.setRequired(true);
password.setRequired(true);
submit.setClickShortcut(KeyCode.ENTER);
setMargin(true);
setSizeFull();
VerticalLayout layout = new VerticalLayout(new FormLayout(username, password), submit);
layout.setWidth(null);
addComponent(layout);
layout.setComponentAlignment(submit, Alignment.BOTTOM_RIGHT);
setComponentAlignment(layout, Alignment.MIDDLE_CENTER);
submit.addClickListener(new LoginAuthentication(username, password));
}
}