Here you can find the source of getAllFontNames()
Returns all the font names that are available in the system.
static Set<String> getAllFontNames()
//package com.java2s; import java.awt.GraphicsEnvironment; import java.util.Set; import java.util.TreeSet; public class Main { /**/*from www . j ava 2 s . c o m*/ * <p> * Returns all the font names that are available in the system. * </p> * @return all the font names that are available in the system. */ static Set<String> getAllFontNames() { Set<String> set = new TreeSet<String>(); String[] fontNames = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); for (String fontName : fontNames) { set.add(fontName); } return set; } }