[英]How to change the Font in the entire Swing UI application
我做了一个 swing 应用程序。 现在我想更改整个 Swing 应用程序的字体,以便添加的任何组件都应仅遵循该字体。 有没有办法达到同样的效果?
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 );
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.