Al-Punk
Al-Punk

Reputation: 3659

Vaadin Checking which component has focus

Is there a way to find out which component has the actual focus in a Vaadin window!?

Upvotes: 5

Views: 5224

Answers (2)

Samuel
Samuel

Reputation: 11

You can add a focusListener and a blurListener to each component. If a component has focus you set an object to the current component, if blurListener gets called you set it to null.

If the object is != null you just need to check which component it is and you know which one has focus.

Upvotes: 1

Miki
Miki

Reputation: 7188

No, at least not directly (which is surprising). Please follow the links and discussions indicated in the thread on Vaadin forum.

You can go around it, but it will require certain amount of work. A starting point is the Focusable interface. Basically, you should capture all focus events in all the components.

Upvotes: 2

Related Questions