Comparison of DPI Scaling in GUI Frameworks

My new article DPI Scaling in Windows GUIs illustrates how four popular Windows GUI frameworks deal with High DPI Settings in Windows. The candidates include:

  • Windows Presentation Foundation (WPF) – scales automatically and perfectly
  • Windows Forms – can match WPF with some effort, but can also fail spectacularly
  • JavaFX – scales well, unless using explicit sizes which don’t scale at all
  • Java Swing – ranges from “completely obsolete” to “held back by weird defects”

I took comparison screenshots of a simple grid-based demo application, implemented in all frameworks plus three Swing themes, and executed at 96/120/144 DPI with various display options. Source code and precompiled executables are available for download.

I was especially interested in the up-and-coming JavaFX, and wrote up some notes on my experience so far. The lack of automatic coordinate scaling is a letdown, but it’s otherwise a fairly solid WPF competitor.

Surprisingly, Windows Forms delivered a panopticon of layout failures. This framework was not originally designed for automatic scaling or sizing, and the three different mechanisms that were eventually introduced trip over each other’s feet when used together.

2015-08-24: Updated article for Java SE 8u60 which has fixed DPI scaling by implementing the same automatic coordinate scaling as WPF, with the exception of the special-cased resolution of 120 DPI (125%). JavaFX is now a very solid WPF competitor.

Leave a Reply