FileDocCategorySizeDatePackage
FontLister.javaAPI DocExample755Sat Oct 27 15:57:16 BST 2001None

FontLister

public class FontLister extends Object
Print the list of available fonts.

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] av)


		// A list of fonts, the 1.0 way.
		Toolkit t = Toolkit.getDefaultToolkit();
		printList("the 1.0 way", t.getFontList());

		// The 1.2 way, using getAvailableFontFamilyNames().
		printList("the 1.2 way", 
				GraphicsEnvironment.getLocalGraphicsEnvironment().
				getAvailableFontFamilyNames());

		// Calling getFontList methods activates the AWT Event thread, so:
		System.exit(0);
	
protected static voidprintList(java.lang.String title, java.lang.String[] list)


		System.out.println("Number of Fonts " + title + " = " + list.length);

		for (int i = 0; i<list.length; i++)
			System.out.println("Font " + i + " = " + list[i]);