---
title: 'Adjust font size in Swing applications global'
url: 'https://www.tutego.de/blog/javainsel/2005/12/adjust-font-size-in-swing-applications-global'
markdown: 'https://www.tutego.de/blog/javainsel/2005/12/adjust-font-size-in-swing-applications-global.md'
date: '2005-12-28'
description: 'Use this snippet to set the size of all fonts of the current Swing look and feel: public static void setFontSizeGlobal( int size ){for ( Enumeration e = UIManager.getDefaults().keys(); e.hasMoreElements(); ){ Object key = e.nextElement(); Object value = UIManager.get( key ); if ( value i…'
taxonomy:
  category:
    - Allgemein
---

# Adjust font size in Swing applications global

![Illustration einer tropischen Insel mit Palmen und einem hohen Berg](https://www.tutego.de/blog/javainsel/user/themes/tutego/images/insel-cover.jpg)# Java Blog für Programmierer

[Java Blog für Programmierer](https://www.tutego.de/blog/javainsel/)

## Adjust font size in Swing applications global

28.12.2005 · [Christian Ullenboom](https://www.tutego.de/blog/javainsel/author/admin/)

Use this snippet to set the size of all fonts of the current Swing look and feel:

```java
public static void setFontSizeGlobal( int size ){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 ) );    }}}
```

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.

Kategorien: [Allgemein](https://www.tutego.de/blog/javainsel/category/allgemein/)

[← Alle Beiträge](https://www.tutego.de/blog/javainsel/)

---

## Navigation

- Previous: [JAXB 2.0 und XJC in einem Ant-Skript nutzen](https://www.tutego.de/blog/javainsel/2005/12/jaxb-2-0-und-xjc-in-einem-ant-skript-nutzen.md)
