How to change the font throughout the Swing UI application

I made a rocking app. Now I want to change the font of the entire Swing application, so that any component added should follow this font only. Is there any way to achieve the same?

+4
source share
1 answer
public static void setGlobalFont( Font font ) { Enumeration keys = UIManager.getDefaults().keys(); while (keys.hasMoreElements() ) { Object key = keys.nextElement(); Object value = UIManager.get( key ); if ( value instanceof Font ) { UIManager.put( key, font ); } } } 
+9
source

All Articles