On 2006-05-11 07:58:05 +0100, Volker Raum <Volker.Raum@heitec.de> said:
public void setApplicationFont(float increment)
{
Enumeration enumer = UIManager.getDefaults().keys();
while(enumer.hasMoreElements())
{
Object key = enumer.nextElement();
Object value = UIManager.get(key);
if (value instanceof Font)
{
UIManager.put(key, new
javax.swing.plaf.FontUIResource(((Font)value).deriveFont(((Font)value).getSize()+increment)));
}
}
}
public static void main(String[] args){new
Testing().setVisible(true);}
}
Thanx for the Code. Had the same idea, but there are still problems...
It might be due to the use of FontUIResource rather than
a regular font.
I've been using the following code for a while in a few
different projects, now, and all the tree/tables/list
come out as expected:
public static final Font WIDGET_FONT = new Font("Tahoma",
Font.PLAIN, 11) ;
public static final Font BOLD_FONT =
WIDGET_FONT.deriveFont(Font.BOLD) ;
public static void setupFont() {
UIDefaults defaults = UIManager.getDefaults() ;
for (Enumeration e = defaults.keys() ; e.hasMoreElements() ; ) {
Object key = e.nextElement() ;
if (key.toString().indexOf("font") >= 0) {
defaults.put(key, WIDGET_FONT) ;
}
}
}
HTH
--
JFB
Thanx for the Code, but try to set the WIDGET_FONT to size 16 or 20.