Selecting items in tables

Tables can listen to clicks on rows. What you need to do is to add an ItemClickListener method to the table:

table.addItemClickListener(this);

Because we are passing a reference to our UI class (this), we must implement ItemClickListener in our BoxwordsUI class:

public class BoxwordsUI extends UI implements ItemClickListener {
  public void itemClick(ItemClickEvent event) { }
}

The itemClick method will be called every time the user clicks on a table row. Let's add that behavior right away.

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.