I am trying to increase the size and fonts of all of the components in frames in my application. I found some code which does so for the fonts via the code below:
private static void setUIFont(javax.swing.plaf.FontUIResource f)
{
Enumeration<Object> keys = UIManager.getDefaults().keys();
while (keys.hasMoreElements())
{
Object key = keys.nextElement();
Object value = UIManager.get(key);
if (value instanceof javax.swing.plaf.FontUIResource)
{
UIManager.put(key, f);
}
}
}
and then calling it via :
setUIFont (new javax.swing.plaf.FontUIResource(new Font("Tahoma",Font.PLAIN, 14)));
Since it worked I thought I will just try and modify it to use DimensionUIResource like seen below:
private static void setUISize(javax.swing.plaf.DimensionUIResource f)
{
Enumeration<Object> keys = UIManager.getDefaults().keys();
while (keys.hasMoreElements())
{
Object key = keys.nextElement();
Object value = UIManager.get(key);
if (value instanceof javax.swing.plaf.DimensionUIResource)
{
UIManager.put(key, f);
}
}
}
and calling it via:
setUISize (new javax.swing.plaf.DimensionUIResource(200, 200));
Unfortunately it doesn't work. Any idea what I am doing wrong with this code? Is there some other way to do it ?