Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.squadd.UI; import com.vaadin.ui.Alignment; import com.vaadin.ui.Button; import com.vaadin.ui.Component; import com.vaadin.ui.FormLayout; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.TextField; /** * * @author SharkNado */ public class ConfirmRegistrationLayout extends FormLayout { private boolean inUse = false; private TextField confirmNumber; private Label confirmation; public ConfirmRegistrationLayout() { setVisible(false); configureComponents(); buildLayout(); } private void configureComponents() { confirmNumber = new TextField("Confirm number"); confirmation = new Label("Now confirm your email address. To do this enter the confirmation\n" + "number you will receive soon on your email in appropriate field\n. Thanks you"); } private void buildLayout() { HorizontalLayout confirmLabel = new HorizontalLayout(confirmation); centerAligningComponent(confirmLabel, confirmation); HorizontalLayout confirmTextField = new HorizontalLayout(confirmNumber); centerAligningComponent(confirmTextField, confirmNumber); addComponents(confirmLabel, confirmTextField); } public void setConfirmNumber(TextField confirmNumber) { this.confirmNumber = confirmNumber; } public void setConfirmation(Label confirmation) { this.confirmation = confirmation; } public TextField getConfirmNumber() { return confirmNumber; } public Label getConfirmation() { return confirmation; } private void centerAligningComponent(HorizontalLayout where, Component what) { where.setSizeFull(); where.setComponentAlignment(what, Alignment.TOP_CENTER); } public boolean isInUse() { return inUse; } public void setInUse(boolean inUse) { this.inUse = inUse; } }