Search code examples
javajavafxjavafx-8stage

Undecorated Stage jump for different screen scales in windows


I have two monitors. one is at 100% windows 10 scale and the other is at 200%. When dragging my javafx stage from one window to the other I have a big jump when the mouse crosses from one screen to the other.

I monitored the x positions of my stage while dragging and it seems that at some point the second screen initial x position is 0 instead of my other screen resolution.

This is what I have on my on mouse pressed callback:

xOffset = stage.getX() - mouseEvent.getScreenX();
yOffset = stage.getY() - mouseEvent.getScreenY();

and this is how I handle the dragging for my stage:

stage.setX(event.getScreenX() + xOffset);
stage.setY(event.getScreenY() + yOffset);

Solution

  • This was fixed in version later than java 8.