Writing a scaling interface

How do you guys go about programming a scaleable interface? Do you design your interface at a default size and add a “scaleFactor” variable to every fixed number? Or do you write the interface such that everything is defined with a float between 0 and 1 and the whole interface is built around multiplying this value by getHeight() or getWidth()?

Do something like:


That won’t take care of popup menus (including combo box popups). Just scale your popup Font in LookAndFeel appropriately.

Thats not quite what i mean. I mean that i could define my entire interface using ratios that multiply against getwidth() and getheight() or i could write it all defined to a fixed size (like 800x400) for dialing in placement and then use a scaling variable multiplied by all of the fixed values used in the fixed size. Which approach would you do?

I use ratios

1 Like

I second the use of ratios.

ratios it is! Thanks guys

Are you aware of the built in
Desktop::getInstance().setGlobalScaleFactor (ratio)

I use XML defined layouts:

EDIT: updated the links…

1 Like