class Toolkit Get Font List

class Toolkit Get Font List

class Toolkit Get Font List

Summary: In this tutorial "class Toolkit Get Font List", explained usage of ToolKit class to get font list supported by Java graphics.

java.awt.Toolkit is an abstract class and can be used by the programmer to interact with the operating system to know some data supported by the OS. In the program, we used to know the font names supported which can be used in the program to create a font object.

Following is the class signature

public abstract class Toolkit extends Object

Program printing font list

class Toolkit Get Font List
Output screen JavaFontNames.java of class Toolkit Get Font List

Toolkit is an abstract class and its object cannot be created directly. We require a factory method to do the job. The factory method here is getDefaultToolkit() which returns an object of Toolkit class. Now tk works like an object for all practical purposes. With tk, we can call all the methods of Toolkit class.

Similarly you can get color components information by using Color class methods.

Leave a Reply

Your email address will not be published. Required fields are marked *