Search code examples
javaswingnetbeansawtnetbeans-platform

How can I dynamically scale (enlarge) all GUI controls in my NetBeans Platform-based application to support accessibility?


I'm working on a NetBeans Platform application and want to ensure accessibility by dynamically scaling up the GUI components for users with visual impairments. Is there a way to achieve this programmatically for all GUI controls?

Primarily, I'm looking for a way to iterate through all the UI controls in the NetBeans Platform and somehow (are there setters for this?!) dynamically set the scaling in both the x and y dimensions based on the user's previous adjustment through the GUI. I would greatly appreciate it if someone could show me how to perform such an iteration and the API for setting the scaling.


Solution

  • I don't know if there is a Netbeans API for this. But it's a Java app so you can use the JDK flag sun.java2d.uiScale.

    For example with an Ant-based NB app, your app could update file nbproject/project.properties with run.args.extra=-J-Dsun.java2d.uiScale=1.5

    It's not truly dynamic as you need to restart the app (after user confirmation) to apply the changes, but it might be acceptable for this kind of setting.