Java tutorial
//package com.java2s; import java.awt.Font; import java.util.Enumeration; import javax.swing.UIManager; public class Main { /** * Returns a string with all fonts used by Swing's UIManager. */ public static String getUIFonts() { final StringBuffer fonts = new StringBuffer(128); fonts.append("Default font: "); fonts.append(getUIFont().toString()); final Enumeration<Object> keys = UIManager.getLookAndFeelDefaults().keys(); String lf = System.getProperty("line.separator"); while (keys.hasMoreElements()) { final Object key = keys.nextElement(); final Object value = UIManager.get(key); if (value instanceof Font) { final Font ifont = (Font) value; fonts.append(lf + key.toString() + " " + ifont.getName() + " " + ifont.getStyle() + " " + ifont.getSize()); } } return fonts.toString(); } /** * Returns the default "Label.font" as used by Swing's UIManager. */ public static Font getUIFont() { return (Font) UIManager.get("Label.font"); // and NOT: return (Font)UIManager.getLookAndFeelDefaults().get("Label.font"); } }