-
Book Overview & Buying
-
Table Of Contents
Vaadin 7 Cookbook
When we need to pass data from the user to the server, we use input fields. When we have more fields, we arrange them into forms. Creating forms in Vaadin is very easy. In this recipe, we will create a simple login form panel as shown in the following screenshot:

Carry out the following steps to create a simple login form:
We create a Vaadin project with a main UI class named Demo.
public class Demo extends UI {…}Our form will be wrapped in the Panel container. Therefore, we create a LoginFormPanel class that extends the Panel class.
public class LoginFormPanel extends Panel {…}All the parts of the form lie in the constructor. First, we set the name and size of the form.
public LoginFormPanel() {
super("Login");
setSizeUndefined();
…We will use FormLayout for the fields. In this layout, captions are rendered to the left of their respective components. Margin top and margin bottom are by default set to true. Through the setMargin(true) method...
Change the font size
Change margin width
Change background colour