// Name of the file :: Fonts.java // created by :: Sridhar Kandukuri // Date :: 07/15/98 // Description :: program to demostrate how to use fonts // To compile :: javac Fonts.java // To execute :: appletviewer Fonts.html import java.applet.Applet; import java.awt.*; public class Fonts extends Applet { public void paint (Graphics page) { setBackground(Color.white); // this is the string that is printed in different fonts & sizes String quote = new String("Graphics is fun!!!"); // set the TimesRoman font with size 14. page.setFont(new Font("TimesRoman", Font.PLAIN, 14)); page.drawString(quote,20,20); // set the bold TimesRoman font with size 16 page.setFont(new Font("TimesRoman", Font.BOLD, 16)); page.drawString(quote,20,40); // set the Italicized Helvetica font with size 18 page.setFont(new Font("Helvetica", Font.ITALIC, 18)); page.drawString(quote,20,65); // set the bold Courier font with size 20 page.setFont(new Font("Courier", Font.BOLD, 20)); page.drawString(quote,20,90); // set the plain SansSerif font with size 24 page.setFont(new Font("SansSerif", Font.PLAIN, 24)); page.drawString(quote,20,120); } } // end class Fonts