ADDITIONAL SYSTEM INFORMATION :
JavaFX 17, Windows 10, JDK 11
A DESCRIPTION OF THE PROBLEM :
JavaFX 17.
When a display where we show the application is unplugged, the application moves to another display and JavaFX fails to recognize it.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Have two monitors with two different scaling factors: A and B.
2. Open a JavaFX application on a monitor A.
3. Unplug the monitor A.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The application is physically moved to the monitor B and it's rendered with the scaling factor of the monitor B.
ACTUAL -
The application is physically moved to the monitor B, but it's rendered with the scaling factor of the monitor A.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
// Nothing special here, a simple application with a button.
public class SmokeTest extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("Hello World!");
Button btn = new Button();
btn.setText("Say 'Hello World'");
StackPane root = new StackPane();
root.getChildren().add(btn);
primaryStage.setScene(new Scene(root, 300, 250));
primaryStage.show();
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No workaround found. But moving the window towards the edge of the screen helps.