Your browser does not support Javascript or Javascript is disabled. Please enable Javascript to view this page content properly!

Synthetica V3 - UI-Scaling support(20:30, 27. Sep. 2017)

Some modern displays offer high pixel density - commonly known as Ultra-HD, 4K, 5K or something similar. Without upscaling your application becomes almost unusable because it appears pretty tiny on these displays if not upscaled from the OS. In Synthetica 2.X.X a font scale factor can be set, so your application is still usable. However, for complete UI-scaling support Synthetica V3 is required. Which means all sizes, insets, gaps, dimensions, images, icons, font get scaled depending on the provided scale factor.

UI-scaling is enabled by specifying a percentage scale factor on application startup through the UI-property "Synthetica.scaleFactor".

Most scaling is done under the hood, but sometimes you have to specify fixed size values in your application. To make these values scalable too, Synthetica's HiDpi class provides some static helper methods which can be used as value wrapper or replacement for constructors just like in the examples below.

Icon Scaling

Generally icons also have fixed sizes - to make icons scalable the HiDpi class provides the wrapper method #createIcon(Icon icon) and additional methods (#createIcon(Class<?> resourceBase, String... fileNames)) for high resolution support. By specifying at least one high resolution icon, multi-resolution support is enabled. Which means depending on the size the best matching icon will be used automatically.

// use HiDpi wrapper to make an icon scalable
Icon myIcon = new ImageIcon(getClass().getResource("/resources/myIcon.png"));
button.setIcon(HiDpi.createIcon(myIcon))
// can be simplified with line below
button.setIcon(HiDpi.createIcon(getClass(), "/resources/myIcon.png"));
// by adding a high resolution icon, multi-resolution support is enabled
button.setIcon(HiDpi.createIcon(getClass(), "/resources/myIcon.png", "/resources/myIcon@2x.png"));

SyntheticaAddons V3 also provides a font based icon library set with around 7.000 free icons. These vector icons are already scalable and don't have to be wrapped. Our IconFontBrowser application helps you to find the needed icon and generates the code for using within your own application.

IconFontBrowser Tool

Swing UI-Scaling

As you maybe know since Java 9 you can also enable UI-scaling with the system property sun.java2d.uiScale and Swing UI-scaling is automatically enabled on high-resolution displays. However, we recommend to use Synthetica's UI-scaling feature because the setting can be stored in the XML-file of a theme and the scaling results are generally better. By using Swing UI-scaling some artifacts can appear, so it's actually recommended to disable Swing UI-Scaling in high-resolution/HiDpi environments by setting the system property sun.java2d.uiScale.enabled to false.