JDK-8158193 : JavaFX Draws wrong on Retina displays
  • Type: Bug
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: 8u92
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: other
  • CPU: x86
  • Submitted: 2016-05-25
  • Updated: 2017-02-23
  • Resolved: 2016-06-19
Related Reports
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
OS X El Capitan (10.11.5)
Result of uname command:
Darwin 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64

EXTRA RELEVANT SYSTEM CONFIGURATION :
MacBook Pro (Retina, 15-inch, Late 2013) and Thunderbolt Display

A DESCRIPTION OF THE PROBLEM :
I found 2 bugs in your bug tracker, but I can't comment in your system, so I report about a new bug. I have additional information about "steps to reproduce". 
    1. JDK-8081714 JavaFX Draws wrong on Retina displays (this bug is closed, but I can reproduce the problem in the latest release version of Java)
    2. JDK-8087565 Scaling problem on OSX Retina.

I have the following configuration of Displays (and this is important part to reproduce the bug):
Resolution Of Build-in Retina Display: Default for display
Resolution Of Thunderbolt Display: Default for display
Arrangement: built-in retina display on the left side, Thunderbolt on the right side and Thunderbolt is main screen

When a JavaFX window loads on a Retina screen (and a non-retina screen is attached), everything is scaled wrong. When you move the window to the non-retina screen, it scales correctly and then stays correct when moved back to the retina screen.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Config your displays:
    Arrangement of your Displays should be:
         - built-in retina display on the left side,
         - Thunderbolt on the right side
         - Thunderbolt is the main screen.
2) In Netbeans 8.0.2 I created JavaFX FXML Application and added small change to open the app on built-in Retina Display.
3) In class JavaFXApplication2 add 2 lines of code to open the app on the built-in retina Display:
        stage.setX(-700);
        stage.setY(500);
4) Run the app

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The window should scale correctly on all displays.
ACTUAL -
The window is scaled wrong on built-in Retina display.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
public class JavaFXApplication2 extends Application {
    
    @Override
    public void start(Stage stage) throws Exception {

        // Open on the built-in Retina Display        
        stage.setX(-700);
        stage.setY(500);
        
        Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
        
        Scene scene = new Scene(root);
        
        stage.setScene(scene);
        stage.show();
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }
    

public class FXMLDocumentController implements Initializable {
    
    @FXML
    private Label label;
    
    @FXML
    private void handleButtonAction(ActionEvent event) {
        System.out.println("You clicked me!");
        label.setText("Hello World!");
    }
    
    @Override
    public void initialize(URL url, ResourceBundle rb) {
        // TODO
    }    
    
}

<AnchorPane id="AnchorPane" prefHeight="200" prefWidth="320" xmlns:fx="http://javafx.com/fxml/1" fx:controller="javafxapplication2.FXMLDocumentController">
    <children>
        <Button layoutX="126" layoutY="90" text="Click Me!" onAction="#handleButtonAction" fx:id="button" />
        <Label layoutX="126" layoutY="120" minHeight="16" minWidth="69" fx:id="label" />
    </children>
</AnchorPane>
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Open the window on Primary Screen


Comments
According to the submitter, this bug is an additional comment about 'reproducer' to JDK-8087565. Closing this as a duplicate by linking the bug to JDK-8087565.
31-05-2016