# Vertically center popup but fixed X position

**URL:** <https://forum.inductiveautomation.com/t/vertically-center-popup-but-fixed-x-position/52161>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [October 20, 2021, 2:45pm UTC](https://forum.inductiveautomation.com/t/vertically-center-popup-but-fixed-x-position/52161 "2021-10-20T14:45:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [October 20, 2021, 2:45pm UTC](https://forum.inductiveautomation.com/t/vertically-center-popup-but-fixed-x-position/52161/1 "2021-10-20T14:45:42Z")

</div>

Using Windows and Ignition 8.1

I have a navigation popup that due to animation can’t be a docked window, and I need to set the popup location to a fixed X position (0), but vertically centered in the screen.

I’m opening the popup using the system.nav.swapTo() function and then using .setLocation on the returned window object.

Right now we are using the system.gui.getScreens() to get the screen height, but that doesn’t take into consideration the scale factor that might be present on that screen.

Is there anyway to use the .setLocation to set the window vertically centered? Or is there a way to grab the scaling factor used on the screen? Or even better get the actual usable resolution of the screen with the scaling factor applied?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 20, 2021, 3:40pm UTC](https://forum.inductiveautomation.com/t/vertically-center-popup-but-fixed-x-position/52161/2 "2021-10-20T15:40:18Z")

</div>

You can see what information Java has via the singleton [`Toolkit`](https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/Toolkit.html#getDefaultToolkit()) and [`GraphicsEnvironment`](https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/GraphicsEnvironment.html#getLocalGraphicsEnvironment()) classes.  
It seems that `toolkit.getScreenResolution()` is your best bet.

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [October 20, 2021, 5:54pm UTC](https://forum.inductiveautomation.com/t/vertically-center-popup-but-fixed-x-position/52161/3 "2021-10-20T17:54:00Z")

</div>

I ended up using this (basically) to get similar information but with accurate dimensions for the screens:

```auto
	ge = GraphicsEnvironment.getLocalGraphicsEnvironment()
	screens = []
	i = 0
	for gd in ge.getScreenDevices():
		gb = gd.getDefaultConfiguration().getBounds()
		screens.append([i,gb.width,gb.height])
		i+=1

```

When I take a look at the screens array, now I get a tuple with the correct height and width of the screen based on the scale factor set on the screen… and it works like a charm!

Thanks for the help @paul-griffith
