Solved

using getFontList()

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
noX challenge 17 76
maven example error 3 35
eclipse java  build path 6 18
Cipher Configuration on Apache HTTPD 4 17
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 …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

707 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

13 Experts available now in Live!

Get 1:1 Help Now