Solved

using getFontList()

Posted on 1998-11-19
2
167 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

912 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now