JDK-8281058 : Windows: Scaling doesn't change when a display is unplugged
  • Type: Bug
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: openjfx17
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2022-01-31
  • Updated: 2022-02-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
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.


Comments
I can reproduce this when the primary screen is set to the external monitor, and if that monitor has a different scale than the laptop screen. If I bring up a window on the primary (external) screen, and then disconnect that screen, the window doesn't react to the different scale of the laptop screen. I think this is at least somewhat related to JDK-8251912, so it would be good to look at both at the same time.
04-02-2022

This might be related to JDK-8251912, although it is a somewhat different case.
03-02-2022