Text mismeasured at certain Windows DPI levels

Chris Nahr chris.nahr at gmail.com
Fri Mar 9 09:58:24 UTC 2018


I've found a pretty serious issue with CheckBox labels on Windows DPI 
levels other than 100% or 200%. Apparently the label mismeasures itself 
during layout, so its text is cut off with an ellipsis.

I've attached a simple program to reproduce this. Running with 
-Dglass.win.uiScale=100%, 125%, 150%, 175%, 200% cuts off all CheckBox 
labels on any DPI scale between 100% and 200%. My environment is Java SE 
9.0.4 on Windows 10 Creators Update.

The only workaround I found was to set an explicit minimum width for the 
CheckBox. In that case the incorrect self-measurement of the label text 
is ignored and the full text displayed.

Best regards,
Christoph Nahr


----- Test Program -----

import javafx.application.*;
import javafx.scene.*;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.stage.*;

public class CheckBoxLabel extends Application {

     public static void main(String[] args) {
         Application.launch(args);
     }

     @Override
     public void start(Stage stage) {
         final HBox box = new HBox();
         for (int i = 0; i < 4; i++)
             box.getChildren().add(new CheckBox("Check"));

         stage.setScene(new Scene(box));
         stage.show();
     }
}


More information about the openjfx-dev mailing list