Get all font family names in your system in Java
Description
The following code shows how to get all font family names in your system.
Example
//from ww w . j av a 2 s . co m
import java.awt.Font;
import java.awt.GraphicsEnvironment;
public class Main {
public static void main(String[] a) {
GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment();
String[] fontnames = e.getAvailableFontFamilyNames();
for (String s : fontnames) {
System.out.println(s);
}
}
}