font getToolkit list
A friend loaned me the ancient Teach Yourself Java in 21 days from Sams Publishing.
In "Day 9", there is this vague reference to getToolkit().
"The fonts you have available to you in your applets depend on which fonts are installed on the system where the applet is running. If you pick a font for your applet and that font isn't available on the current system, Java will substitute a default font (usually Courier). You can get an array of the names of the current fonts available in the system using this bit of code: String[] fontslist = this.getToolkit().getFontList();"
I searched the API and it is confusing where it is located. The book says it is in java.awt.Font, the API says its in java.awt.Window.. another place in API says it is in java.awt.Toolkit. So I dont know where the hell it is.
Whatever the case, I cant figure out how to get it to work. Here is my code:
import java.awt.*;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Toolkit;
import java.awt.Window;
public class FontList{
public static void main(String args[]){
String[] fontslist = getToolkit().getFontList();
for(int i = 0; i < fontslist.length; i++){
System.out.println(fontslist +"\n");
}
}
}
What am I doing wrong? Thanks in advance for any assistance.
Regards

