Window always at the Top Right of the different size of any browsers

Hi,

I am using Vaadin 8 and I have a problem where I use SetPositionX and SetpositionY in making the window at the top right of any browser sizes… how could I do it? do u have suggestions?

Hey,

window.setPositionX(getUI().getPage().getBrowserWindowWidth()-(int)window.getWidth());
window.setPositionY(0);

You need to make sure that you window width is not in %. If you never set a pixel width just look it up in the browser and hardcode it.

Hi! Michael,

         the Window is not set in the pixel width nor the  %  it works at the top corner but  when the screen is bigger the width cannot go into right.. .see the attachment

40920.png

Hey,

ok can you post your code to create that window?
I don’t think I understand your problem.
I understand this:
So you have a window with a width and it get placed in the top right but now you want to resize your browser and have the window still stay at the top right?
If that’s your question then add

getUI().getPage().addBrowserWindowResizeListener(event -> {...})

where you can adjust your X-Position to the new browser width.

Hi I use that and it works thank you!