GraphicsEnvironment: getAvailableFontFamilyNames()
/*
* Output:
Fonts available on this platform:
Agency FB
Arial
Arial Black
Arial Narrow
Arial Rounded MT Bold
Arial-SM
Blackadder ITC
Bodoni MT
Bodoni MT Black
Bodoni MT Condensed
Book Antiqua
Bookman Old Style
Bookshelf Symbol 7
Bradley Hand ITC
Calisto MT
Castellar
Century Gothic
Century Schoolbook
Comic Sans MS
Copperplate Gothic Bold
Copperplate Gothic Light
Courier New
.....
.....
* */
import java.awt.GraphicsEnvironment;
public class MainClass {
public static void main(String[] args) {
GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment();
String[] fontnames = e.getAvailableFontFamilyNames();
System.out.println("\nFonts available on this platform: ");
for (int i = 0; i < fontnames.length; i++)
System.out.println(fontnames[i]);
return;
}
}
Related examples in the same category