There is no command line switch to change the font size for Swing. You will need to call the following method:
public static void adjustFontSize(int adjustment) { UIDefaults defaults = UIManager.getDefaults(); List<Object> newDefaults = new ArrayList<Object>(); Map<Object, Font> newFonts = new HashMap<Object, Font>(); Enumeration<Object> en = defaults.keys(); while (en.hasMoreElements()) { Object key = en.nextElement(); Object value = defaults.get(key); if (value instanceof Font) { Font oldFont = (Font)value; Font newFont = newFonts.get(oldFont); if (newFont == null) { newFont = new Font(oldFont.getName(), oldFont.getStyle(), oldFont.getSize() + adjustment); newFonts.put(oldFont, newFont); } newDefaults.add(key); newDefaults.add(newFont); } } defaults.putDefaults(newDefaults.toArray()); }
where adjustment is the number of points that should be added to each font size.
If you do not have access to the source code, you can always write your own main wrapper class, where you call
UIManager.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (event.getPropertyName().equals("lookAndFeel")) { adjustFontSize(5); } } });
before calling the main method of the actual application.
However, if the font size is very small, it will most likely be set explicitly, so changing the default values ββmay not help.
source share