Java examples for 2D Graphics:Font
available Fonts Map
//package com.java2s; import java.awt.Font; import java.awt.GraphicsEnvironment; import java.util.HashMap; import java.util.Map; public class Main { public static Map<String, Font> availableFontsMap = availableFontsMap(); public static Map<String, Font> availableFontsMap() { Font[] fonts = availableFonts(); Map<String, Font> fontsMap = new HashMap<String, Font>(); for (Font font : fonts) { fontsMap.put(font.getFontName(), font); }/*from w w w.ja v a 2 s .c o m*/ return fontsMap; } public static Font[] availableFonts() { GraphicsEnvironment environment = GraphicsEnvironment .getLocalGraphicsEnvironment(); return environment.getAllFonts(); } }