Time for action – adding icons
Follow these steps and see how icons beautify applications:
Create a new Vaadin project. We are using icons as project name.
Add some class level fields for the input components in your
UI
class:public class IconsUI extends UI { private TextField tf = new TextField("Email"); private ComboBox cb = new ComboBox("Type"); private TextArea ta = new TextArea("Details"); private OptionGroup og = new OptionGroup("Priority"); private Button bt = new Button("Send"); // ... }
We don't want to go out of shape with our Vaadin skills right? Add all the input components using your knowledge to a layout like this:
If you don't want to do this, you have two options: Copying the code from the book's source code, or adding all the components to a simple vertical layout.
Add the highlighted lines of code to the end of the init method:
public class IconsUI extends UI { // ... protected void init(VaadinRequest request) { tf.setIcon(new ClassResource("email.png...