Solved

using getFontList()

Posted on 1998-11-19
2
171 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …

690 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