GraphicsEnvironment: getAvailableFontFamilyNames() : GraphicsEnvironment « java.awt « Java by API






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

1.GraphicsEnvironment: getAllFonts()
2.GraphicsEnvironment: getCenterPoint()
3.GraphicsEnvironment: getDefaultScreenDevice()
4.GraphicsEnvironment: getLocalGraphicsEnvironment()
5.GraphicsEnvironment: getScreenDevices()