1

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

Community
  • 1
  • 1
underkuerbis
  • 325
  • 3
  • 9

2 Answers2

2

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
José Pereda
  • 44,311
  • 7
  • 104
  • 132
  • I've tried both suggestions, but unfortunately they don't seem to change anything... I'm using OS X Yosemite if this makes any difference... – underkuerbis May 09 '15 at 15:39
  • 1
    Can you post what `-Dprism.verbose="true"` gives you? On Windows, I've noticed that with `-Dprism.allowhidpi="false"` I get `Not opting in for HiDPI pixel scaling`, while `-Dprism.allowhidpi="true"` gives `Opting in for HiDPI pixel scaling`. – José Pereda May 09 '15 at 16:02
  • I get the same output. Interestingly I also get `Opting in for HiDPI scaling` when I don't set `allowhidpi` flag. I guess this only _allows_ JavaFX to use HiDPI scaling, not _forces_ it to use it!? – underkuerbis May 09 '15 at 19:21
  • So by default JavaFX will try to use Hi-DPI by default, but as you say, it doesn't force it. Maybe you have to simulate it on your display (check this [question](http://stackoverflow.com/questions/12124576/how-to-simulate-a-retina-display-hidpi-mode-in-mac-os-x-10-8-mountain-lion-on)). – José Pereda May 09 '15 at 20:27
  • Thanks!! Tested successfully on Windows10 with a DELL XPS-13 and QHD screen, but I setted it to "false" to let Windows10 do the scaling instead of JAVAFX – Daniel Jan 04 '17 at 15:07
0

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>
marc
  • 977
  • 9
  • 14