Here you can find the source of setFontScale(float scale)
public static void setFontScale(float scale)
//package com.java2s; //License from project: Open Source License import java.awt.Font; import java.util.HashMap; import java.util.Map; import javax.swing.UIManager; public class Main { private static Map<String, Font> originals; public static void setFontScale(float scale) { if (originals == null) { originals = new HashMap<>(25); for (Map.Entry entry : UIManager.getDefaults().entrySet()) { Object key = entry.getKey(); if (key.toString().toLowerCase().contains(".font")) { Object value = entry.getValue(); Font font = null; if (value instanceof Font) { font = (Font) value; originals.put(key.toString(), font); }//from w ww.ja va 2 s. c om } } } for (Map.Entry<String, Font> entry : originals.entrySet()) { String key = entry.getKey(); Font font = entry.getValue(); float size = font.getSize(); size *= scale; font = font.deriveFont(Font.PLAIN, size); UIManager.put(key, font); } } }