Time for action – creating a custom component

Have you ever accepted license terms when installing software? Sometimes you can click the Install button only and only if you have previously checked a Yeah right. I do Accept the Terms checkbox. Let's make a custom component to emulate that corporate praised behavior. The steps to create a custom component are as follows:

  1. Create a new Vaadin project with the name customcomponent using your IDE.
  2. Create a new class extending CustomComponent:
    public class AcceptTermsButton extends CustomComponent {
    
    }
  3. We need three components: a CheckBox, a Button, and a VerticalLayout:
    public class AcceptTermsButton extends CustomComponent {
    
      private VerticalLayout layout = new VerticalLayout();
      private CheckBox checkbox ...

Get Vaadin 7 UI Design By Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.