Is there a way to scale all the Swing components in an app by a single factor? I have an existing Swing app, and I want to display all the components at double size. Is this possible?
EDIT:
I’m porting a Java Swing app to Sugar (OLPC XO Graphics Environment). I don’t have accessibility functionalities. The machine has only one resolution of 1200×900 in a 7.5” display. So the components are really small and unreadable.
Unluckily there is no such standart feature in Swing.
Every component size in application is determined by layout of the container where that component is added and component’s preferred/minimum sizes, provided by their UIs.
So the best way (as i see it) is to modify standart UIs, so they provide additional preferred size (doubled in your case). But you will have to do that separately for each component of a certain type (buttons/checkboxes/tables/trees/scrolls e.t.c.). Plus you cannot change the system UIs – you could only extend some cross-platform Look and Feel like Metal LaF and that won’t be useful at all in case you are using native Look and Feel.
You can change some default L&F properties though, like font:
This specific case changes only buttons font. There are also a lot of other components font properties that you can find in any LookAndFeel class (for e.g. BasicLookAndFeel).