Java Font from System getAllFontNames()

Here you can find the source of getAllFontNames()

Description

Returns all the font names that are available in the system.

License

Open Source License

Return

all the font names that are available in the system.

Declaration

static Set<String> getAllFontNames() 

Method Source Code


//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;
    }
}

Related

  1. availableFonts()
  2. getAllAvaiableSystemMonoSpacedFonts()
  3. getAllAvailableFonts()
  4. getDefaultBorderInsets(int fontSize)
  5. getDefaultFont()
  6. getDefaultFont()
  7. getDefaultFont()