How to make different fonts appear in JTextField. Say a Hindi font or chinese font

Ashwin Chathuruthy

In the java code you must put only the following line

        JTextFiledName.setFont(new Font("Shusha", Font.PLAIN, 16));

Make sure you have the following setup done.

To display a font. Say a hindi font like Shusha. You must edit a file called in the jre/lib(in jdk1.2.2) and in my case Java2 under Visual cafe. Make the following modifications to that file.

Add the line below.


Note if you are adding another font make sure it becomes


Then repeat for bold, italics etc




After that add the following line under where its written

# font filenames for reduced initialization time


Here SHUSHA is the font name. It can be thoolica.ttf. I think its better to follow the same case of the one shown under the windows/font directory. Like SHUSHA is in all caps

Then add to the line below

# Static FontCharset info.


Now try running the application and enter a text in the text field and voila you get it in the language you want it.

And dont forget to have the font installed in your windows/font directory. If still not working make a copy in the fonts directory under the jvm/fonts directory

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact