如何在整个Swing UI应用程序中更改Font

我做了一个摇摆应用程序。 现在我想更改整个Swing应用程序的Font,以便添加的任何组件都应该只跟随该Font。 有没有办法实现同样的目标?

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 ); } } }