In this section, you will learn how to get the available font.
In order to retrieve all the available fonts, we have used the AWT package. The class GraphicsEnvironment describes the collection of all the available GraphicsDevices and Font objects.
getAllFonts()- This is the method of class GraphicsEnvironment. It returns an array of fonts available in the GraphicsEnvironment.
getFontName()- This is the method of Font class. It returns the font name.
Here is the video tutorial of "How to get available fonts in Java?":
Here is the code of GetAvailableFont .java
Output will be displayed as:
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: November 1, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles