FontMetrics

The FontMetrics Class:
Before we talk too much about the FontMetrics class, it is important to get the meaning of a few terms straight. Refer to the diagram shown below.

Try out this sample listing to see what it does.



List of Available Fonts:
The following application will list the available fonts:


Further Reading: Font Info

Assignment: Create an applet which will take input from the user. If the user enters a string between 5 and 36 characters, your applet will then draw that string in the applet area so that it touches both sides of the applet. You will need to use the methods of the FontMetrics class to select an appropriate font size so that all this will work right. Also you will need to make your applet a size which facilitates drawing the string in the applet area.