Listing All Available Font Families - Java 2D Graphics

Java examples for 2D Graphics:Font

Description

Listing All Available Font Families

Demo Code


import java.awt.GraphicsEnvironment;

public class Main {
  public static void main(String[] argv) {
    // Get all font family names
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    String fontNames[] = ge.getAvailableFontFamilyNames();

    // Iterate the font family names
    for (int i = 0; i < fontNames.length; i++) {
    }/*from   w w  w .  j av a  2s  .  c om*/
  }

}

Related Tutorials