underkuerbis
underkuerbis

Reputation: 335

Force JavaFX Hi-DPI mode to be enabled

Is there a way to "force" JavaFX to enable the Hi-DPI mode? Maybe through some specific VM-argument or something? This would be highly useful for debugging/testing an application without having access to a respective display.

This question already covers the basics about JavaFX 8's Hi-DPI mode pretty well, but it doesn't give any way of "enforcing" the mode to be active: JavaFX 8 HiDPI Support

Upvotes: 2

Views: 4633

Answers (2)

marc
marc

Reputation: 997

For Windows 7 this JVM argument worked for me (Java 8u102) and is necessary to auto scale with all dpi settings. The minimal setting to activate Hi DPI is set to 1 (100%). Without this setting the 125% dpi setting in Windows 7 will not auto-scale, while 150% and 200% will:

-Dglass.win.minHiDPI=1

In an JavaFX Ant deploy the above setting can be applied like this:

<fx:deploy
   <fx:platform javafx="2.1+">
       <fx:property name="glass.win.minHiDPI" value="1"/>
   </fx:platform>
</fx:deploy>

Upvotes: 1

Jos&#233; Pereda
Jos&#233; Pereda

Reputation: 45456

Have you tried using:

-Dprism.allowhidpi="true"

as a command line option, or calling:

System.setProperty("prism.allowhidpi", "true");

at the beginning of your application?

I can't test it on Windows, but on Android (JavaFXPorts) it works when is set as a property in a custom properties file (by default is true, this will disable it):

prism.allowhidpi=false

Upvotes: 3

Related Questions