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:
Create a new Vaadin project with the name customcomponent using your IDE.
Create a new class extending
CustomComponent
:public class AcceptTermsButton extends CustomComponent { }
We need three components: a
CheckBox
, aButton
, and aVerticalLayout
:public class AcceptTermsButton extends CustomComponent { private VerticalLayout layout = new VerticalLayout(); private CheckBox checkbox = new CheckBox(); private Button button = new Button(); }
Create a constructor...