O'Reilly logo

Vaadin 7 UI Design By Example Beginner's Guide by Alejandro Duarte

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – my first table

Following are the steps to create your first table:

  1. Create a new Vaadin project named my-first-table using your IDE.
  2. Edit your UI class to match the following code snippet:
    public class MyFirstTableUI extends UI {
    
      protected void init(VaadinRequest request) {
        final VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        setContent(layout);
      }
    }
  3. Now, add the actual code for the table shown as follows:
    public class MyFirstTableUI extends UI {
    
      protected void init(VaadinRequest request) {
    
        // ...
    
        Table table = new Table();
    
        table.addContainerProperty("Column 1", String.class,
    "(default 1)");
        table.addContainerProperty("Column 2", String.class,
    "(default 2)");
    
        table.addItem(new Object[] { "Hi", "There" }, "item ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required