An applet with different Fonts



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

public class FontExample extends Applet
{
	//Let's create our fonts using the "Font" Java object.
	Font fSerif= new Font("Serif", Font.PLAIN, 12);
	/*The constructor takes 3 variables, the name of the font, the
"style", and the point size.
	*/
	Font fBigSerif = new Font("Serif", Font.BOLD, 24);
	Font fSansSerif = new Font("Sans-Serif", Font.ITALIC, 14);
	Font fMonospace = new Font("Monospace", Font.PLAIN, 14);
	Font fDialog = new Font("Dialog", Font.PLAIN, 14);
	Font fDialogInput = new Font("DialogInput", Font.PLAIN, 14);
	Font fTimesNewRoman = new Font("Times New Roman", Font.PLAIN,
12);
	//If you try to include a font that isn't default with Java...
	Font fSymbol = new Font("symbol", Font.PLAIN, 20);
	// It won't work.  If a GraphicsEnvironment is used instead of the regular
	// Graphics class, more fonts can be accessed.
	
	public void paint(Graphics g)
	{
		//Using a g.setFont() statement, we change the current font, just like
		//g.setColor(). Only one Font can be active at a time.
		g.setFont(fDialogInput);
		g.drawString("Dialog Input", 10, 10);
		g.setFont(fBigSerif);
		g.drawString("Serif", 10, 40);
		g.setFont(fTimesNewRoman);
		g.drawString("Times New Roman", 10, 70);
		g.setFont(fSymbol);
		g.drawString("Symbol", 10, 100);
		g.setFont(fSerif);
		g.drawString("Serif", 10, 130);
		g.setFont(fMonospace);
		g.drawString("Monospace", 10, 160);
		g.setFont(fDialog);
		g.drawString("Dialog", 10, 190);
		g.setFont(fSansSerif);
		g.drawString("Sans-Serif", 10, 220);
	}
}