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 ...

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.