Adjust font size in Swing applications global
0 Kommentar(e). Veröffentlicht von Christian Ullenboom am Mittwoch, Dezember 28, 2005.
Use this snippet to set the size of all fonts of the current Swing look and feel:
public static void setFontSizeGlobal( int size )Can we compact the code? Not with the extended for! It is true that UIDefaults is a subtype of Hashtable but the methods entrySet() or keySet() returns an empty collection.
{
for ( Enumeration e = UIManager.getDefaults().keys(); e.hasMoreElements(); )
{
Object key = e.nextElement();
Object value = UIManager.get( key );
if ( value instanceof Font )
{
Font f = (Font) value;
UIManager.put( key, new FontUIResource( f.getName(), f.getStyle(), size ) );
}
}
}

0 Antwort(en) auf ›Adjust font size in Swing applications global‹
Kommentar veröffentlichen