How to find absolute position of component?

Hello,

I would like to find out the position of a component in pixels relative to the application’s top left border. Is this possible in Vaadin?

Thanks,
David

If you’re using an
AbsoluteLayout
, you can just call
getPosition(Component)
.

Otherwise, you can do it on the client side through GWT.

Old post, but: if I remember correctly, AbsoluteLayout.getPosition() returns the position you have set in the units you have set it, which might not be the pixel position of the component in the browser. That information is normally not communicated back from the client to the server by Vaadin layouts and components, so you would need custom client side code.