FileDocCategorySizeDatePackage
FontList.javaAPI DocExample1105Sat Jun 02 02:41:26 BST 2001None

FontList.java

// This example is from _Java Examples in a Nutshell_. (http://www.oreilly.com)
// Copyright (c) 1997 by David Flanagan
// This example is provided WITHOUT ANY WARRANTY either expressed or implied.
// You may study, use, modify, and distribute it for non-commercial purposes.
// For any commercial use, see http://www.davidflanagan.com/javaexamples

import java.applet.*;
import java.awt.*;

/**
 * An applet that displays the standard fonts and styles.
 **/
public class FontList extends Applet
{
  // The available font families
  String[] families = {"Serif",         // "TimesRoman" in Java 1.0
                       "SansSerif",     // "Helvetica" in Java 1.0
                       "Monospaced",    // "Courier" in Java 1.0
                       "Dialog",        // unchanged
                       "DialogInput" }; // unchanged

  // The available font styles
  int[] styles = {Font.PLAIN, Font.ITALIC, Font.BOLD, Font.ITALIC+Font.BOLD};
  String[] stylenames = {"Plain", "Italic", "Bold", "Bold Italic"};

  public void paint(Graphics g) {
    for(int family=0; family