O'Reilly logo

Vaadin 7 Cookbook by Ondrej Kvasnovsky, Jaroslav Holan

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

Changing Label to TextField by double-clicking

We will create an editable Label class. It will be possible to edit this Label, because after double-clicking on it, the Label will become a TextField. After losing focus, it again becomes a Label. But how to add click listener to the Label or to a similar component that doesn't support such a listener? In those cases we can use LayoutClickListener. This listener is added to the layout in which the component is placed. It's called whenever the user clicks inside the layout.

Changing Label to TextField by double-clicking

How to do it...

Carry out the following steps to create an editable Label:

  1. We create a Vaadin project with a main UI class called ...

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