Get Available Font Family Names - Java 2D Graphics

Java examples for 2D Graphics:Font

Description

Get Available Font Family Names

Demo Code

 
import java.applet.Applet;
import java.awt.Graphics;
import java.awt.GraphicsEnvironment;
 
public class Main {
        public static void main(String[] argv){
                GraphicsEnvironment graphicsEnvironment =
                        GraphicsEnvironment.getLocalGraphicsEnvironment();
                String fontNames[] = graphicsEnvironment.getAvailableFontFamilyNames();
                for(int i=0; i < fontNames.length; i++){
                        System.out.println(fontNames[i]);
                }/* www. j  a va 2 s. c o  m*/
        }
}

Related Tutorials