• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Listing fonts is a problem here

Ranch Hand
Posts: 473
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following code is giving me a hard time finding fonts on my list. I have tried Ivor Horton's example too. The same problem occurs either the code is in an application or in an applet. The code is...
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
// implement Item Listener
public class ListFonts2 extends Applet {
List list;
TextField tf;
public void init() {
setLayout(new BorderLayout());
GraphicsEnvironment env =
String fontList[] = env.getAvailableFontFamilyNames();
list = new List(5, false);
for (int i = 0; i < fontList.length; i++)
add(list, BorderLayout.CENTER);
// register the current applet with the List instance
tf = new TextField();
add(tf, BorderLayout.SOUTH);
// implement the method(s) prescribed in ItemListener

D:\jdk1.3\bin>java FontList
Assertion failed: offset < fFileSize, file ..\..\..\..\src\share\native\sun\awt\
font\fontmanager\fontobjects\fontObject.cpp, line 240
abnormal program termination.
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i don't know what the problem with your code is. but i have a code snippet, which is working fine in my applet/application. why not try this out

though your code looks exactly similar but why not try this too.. maybe this works...
Maki Jav
Ranch Hand
Posts: 473
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx meera for helping me. Both the programmes are ok; problem was that my windows was not functioning properly. I reinstalled it and ...the code works fine!
Not looking good. I think this might be the end. Wait! Is that a tiny ad?
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic