Java Swing – Telugu

Just thought of writing small application in Java to display Telugu fonts. Here is the code for your reference.

Java Telugu Example
Java Telugu Example

import java.awt.Font;

import javax.swing.JFrame;
import javax.swing.JTextArea;

/**
* Copy gautami.ttf from windowsfonts to java_160_10jrelibfonts
*
* References:
*
* http://unicode.org/charts/PDF/U0C00.pdf
* http://java.sun.com/javase/technologies/core/basic/intl/faq.jsp
* http://java.sun.com/j2se/1.4.2/docs/guide/intl/fontprop.html
*
* Load font from file
* http://www.java2s.com/Code/Java/2D-Graphics-GUI/Loadfontfromttffile.htm
*
* http://www.roseindia.net/java/example/java/swing/graphics2D/font-paint.shtml
*
* How to get unicode for telugu from lekhini? type in lekhini. copy text to
* following location. Get unicode.
*
* http://rishida.net/tools/conversion/
*
* When you type in text area, we will get squares. Use Baraha IME. Then you can
* type in telugu.
*/
public class JavaTeluguDemo extends JFrame {

private static final long serialVersionUID = 123123123L;
private static final Font fontTeluguGautami32 = new Font("gautami",
Font.PLAIN, 32);
private static final Font fontTeluguGautami10 = new Font("gautami",
Font.PLAIN, 22);
private static String telugu = "u0C05u0C2Eu0C4Du0C2E";
private static String teluguHeading = "u0C1Cu0C3Eu0C35u0C3E u0C24u0C46u0C32u0C41u0C17u0C41";

public JavaTeluguDemo() {
JTextArea taDisplay = new JTextArea(telugu);
taDisplay.setFont(fontTeluguGautami32);
this.getContentPane().add(taDisplay);
}

public static void main(String[] args) {
// We can't change title font in default system look and feel.
JFrame.setDefaultLookAndFeelDecorated(true);

JFrame frame1 = new JavaTeluguDemo();
frame1.setSize(400, 150);
frame1.setVisible(true);
frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame1.getLayeredPane().getComponent(1).setFont(fontTeluguGautami10);
frame1.setTitle(teluguHeading);

}

}
Advertisements

10 thoughts on “Java Swing – Telugu

  1. I don’t know Java 😦
    But, the code looks small….I will try to learn and then understand it.
    For the moment, I congratulate for the successful output….
    May be it’s time to extend capabilities to do telugu computing…..

    Like

  2. hi! bhavani,
    I’m naresh. Thanks for your small and very useful program. With your program i came to know about preparing telugu words with unicode and now i used them to print months and day names in telugu.

    Thanks for you and your program.
    Naresh.

    Like

  3. Hi!
    అక్క, నా పేరు ఈపరి అమరేష్, తెలుఁగు లో చెయ్యాలని ఎప్పటినుంచో కోరిక ఉన్నది, తగిన ఉన్నాకూడ డౌనలోడ్ చూసికొనినకూడ తగిన ఓపిక చాలలేదు, కాని ఇలాఁగ వాడుకొనఁగలము అని తెలిసికొనిన తరువాత మఱల క్రొత్తఁగా హుషారు కలిఁగినది lOCALIZATION[Internationalization] in Java has always been a mess in comparison to .NET languages, thankU very much.. for demo of displaying in telugu

    Like

  4. I want to read telugu text from a text file and put it at specified location on an image. Save that to another image. How can I do that? I used goutami font. I tried many sample codes given in websites. But none of them are working correctly. Only zeroes are displayed on the image. Please help me

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s