Change the background color of the Layout when clicked on it


I have a Vertical layout inside a table column. I use Column generators to generate the table cell. Now the layout has a Layoutclick event listener attached to it.
I want to change the background color of the layout when it is clicked upon. I searched in vaadin forums but could not find any thing to go ahead about this issue.
Any help is greatly appreciated


  1. Create a custom theme if you don’t have one.
  2. Create a style name with the background-color property set to the color you want.
  3. Use layout.addStyleName with the name you just created in the clicklistener.

Or you could use the
CSS Inject addon