Author | Topic: getFontList() |
Vikram Deshmukh greenhorn |
posted May 09, 2000 01:20 AM
Hi friends, I have some problem with getFontList() function. It returns list of strings . But the basic problem is, its an abstract method, in the abstract class Since Toolkit is an abstract class, i cannot instantiate its object. So is there any other way, so i can use getFontList() method, or its functionality ? Thanx in advance ! from,
|
edward man unregistered |
posted May 09, 2000 10:15 PM
getFontList is deprecated. The following program list all the fonts on your environment. If you really want to use getFontList, uncomment those three lines.
|
maha anna bartender |
posted May 09, 2000 10:57 PM
vikram, YOu can get the Fonts list available to the local system through GraphicsEnvironment class. In fact GraphicsEnvironment class is also an abstract class as Toolkit. I am avoiding Toolkit because its method getFontList() is deprecated. But you can ask , then how can I instantiate the GraphicsEnvironment class ?. From the Java source
For Every platform the JVM creates a GraphicsEnvironment object when you call the static getLocalGraphicsEnvironment() method on GraphicsEnvironment class From this object you call all the methods like getAllFontFamilyNames()/getAllFonts() etc. This is how we get the Font list. Here is a sample program.
Partial Output (The list is too long ) Abadi MT Condensed Abadi MT Condensed Light Arial Arial Black Arial Cursiva Arial Narrow Arial Narrow Italic Arial Narrow fed Arial Narrow fed kursiv Arial Narrow kursiv Arial Negreta Arial Negreta cursiva Book Antiqua Bookman Old Style Bookman Old Style fed Bookman Old Style fed kursiv Bookman Old Style kursiv Bookshelf Symbol 1 Bookshelf Symbol 2 Bookshelf Symbol 3 --------------------------------------------------------- [This message has been edited by maha anna (edited May 09, 2000).]
|
Vikram Deshmukh greenhorn |
posted May 10, 2000 12:48 AM
Thanx !
|
| | |