Solved

using getFontList()

Posted on 1998-11-19
2
168 Views
Last Modified: 2010-03-30
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
getFontList();
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!
0
Comment
Question by:mburrows050897
2 Comments
 
LVL 5

Accepted Solution

by:
fontaine earned 100 total points
ID: 1227910
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
following:

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

// get the list of fonts
String fonts[] = toolkit.getFontList()
0
 

Author Comment

by:mburrows050897
ID: 1227911
Thanks so much, that works perfectly.  I just couldn't get that right!
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question