How do I get the available font family names?

Category: java.awt, viewed: 688 time(s).
 
package org.kodejava.example.awt;
 
import java.awt.Font;
import java.awt.GraphicsEnvironment;
 
public class FontFamilyNameList {
    public static void main(String[] args) {
        //
        // Get all available font family names from GraphicsEnvironment
        //
        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        String familyNames[] = ge.getAvailableFontFamilyNames();
        
        //
        // Iterates familyNames array to display the available font's family names
        //
        for (String familyName : familyNames) {
            System.out.println("Family names: " + familyName);
        }        
    }
}
 
 
Bookmark this example!  

Most Viewed Examples

Google

100 Top & Latest


eXTReMe Tracker
visitor stats