In this program we are going to tell you how you can
change the color of chunk color .This example tell you how you can change
the color of chunk and how you can add fonts and gives the size of the
In this Example we create the object of the paragraph .In this paragraph we add the chunk and set the font by using the getFont(fontname,size,coloor ).The getFont() method is a method of FontFactory. We are changing the color of the chunk by passing the color values into the getFont() method.
The class FontFactory is used to create a Font. It is easiest way to get a new Font object. FontFactory has an API with methods that can construct a Font object of any kind. The constructed font is in a uniform way. There are some CID fonts which are not in it.
The getFont() method is used to gets the current font for the window.The getFont method is used to get Font-Object from FontFactory class.
This is used to set the default size.
Color(0xFF, 0x00, 0x00):
This constructor is used to create the object of the color. We pass three hexadecimal values to which gives the combination of colors.
This is used to set text BOLD.
This is used to set text ITALIC.
This is used to set text style HELVETICA.
The code of the program is given below:
The output of the program is given below:
Liked it! Share this Tutorial