• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 176
  • Last Modified:

using getFontList()

I'm writing a simple applet in 1.1 and want to get the list of fonts available.  I get a compile-time error using
I can't seem to get the syntax right, or perhaps I'm not including all the java classes I need?
Or just not using this function correctly?
String fontnames[];
fontnames = new String[10];
fontnames = getFontList();
Thanks in advance for finding my goofy mistake!
1 Solution
I have verified the methods available in Applet, as well as all the ones that are inherited
from Panel, Container and Component, and there is no getFontList() method available.
If you want to list the fonts available, you have to use the Toolkit class like the

// get a Toolkit instance
Toolkit toolkit = Toolkit.getDefaultToolkit();

// get the list of fonts
String fonts[] = toolkit.getFontList()
mburrows050897Author Commented:
Thanks so much, that works perfectly.  I just couldn't get that right!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now