Tuesday, June 23, 2009

Using Urdu in Java

Other day someone asked me how to use Urdu fonts in Java. So for a sample java program that uses urdu font, you need to do following:

1. Download Nafees Nastaleeq Urdu font from CRULP.

2. Copy the font in C:\WINDOWS\Fonts folder

3. Create following java program. It should display "Usman" in Urdu.


import java.awt.*;
import javax.swing.*;

public class BasicDraw {
public static void main(String[] args) {
new BasicDraw();
}
BasicDraw() {
// Create a frame
JFrame frame = new JFrame();

// Add a component with a custom paint method
frame.getContentPane().add(new MyComponent());

// Display the frame
int frameWidth = 200;
int frameHeight = 200;
frame.setSize(frameWidth, frameHeight);
frame.setVisible(true);
}

class MyComponent extends JComponent {
// This method is called whenever the contents needs to be painted
public void paint(Graphics g) {
int style = Font.PLAIN;
int size = 24;
Font font = null;
font = new Font("Nafees Nastaleeq", style, size);
String text = "\u0639\u062b\u0645\u0627\u0646";
g.setFont(font);

// Draw a string such that its base line is at x, y
int x = 80;
int y = 40;
g.drawString(text, x, y);
}
}
}


4. The resulting image should look like:

38 comments:

Anonymous said...

clomid 100mg days 5-9 | buy clomid without prescription - clomid prices, clomid days 3-7 when will i ovulate

Anonymous said...

clomid wiki | http://buyclomidonline.jimdo.com/#74127 - buy clomid online no prescription usa, can clomid delay your period

Anonymous said...

ovulate early on clomid | [url=http://buy-clomid-online.webs.com/#51760]clomid buy no prescription[/url] - how to buy clomid online, eliu clomid success stories first round

Anonymous said...

clomid ingredients | clomid 50mg et grossesse - clomid online cheap, clomid and nolva pct

Anonymous said...

[url=http://loveepicentre.com][img]http://loveepicentre.com/uploades/photos/2.jpg[/img][/url]
dating to relating pdf [url=http://loveepicentre.com/]dating directory jewish web[/url] adventist programs on dating
dating black book picking up women [url=http://loveepicentre.com/]amy rose dating[/url] dating vintage jbl d130f speaker
fun free sim dating games [url=http://loveepicentre.com/taketour.php]how reliable is carbon dating[/url] free dating service single dating service

Anonymous said...

[url=http://loveepicentre.com/advice.php][img]http://loveepicentre.com/uploades/photos/9.jpg[/img][/url]
how to dating a married woman [url=http://loveepicentre.com/testimonials.php]free top adult dating site[/url] dating gratis video
how do dating sites work [url=http://loveepicentre.com/]ezine online dating[/url] free sex dating and swingers personals
who is alexis bledel dating [url=http://loveepicentre.com/]harmful teen dating relationships[/url] hawaii dating service

Anonymous said...

ebook bela liptak http://audiobookscollection.co.uk/Handbook-of-Political-Theory/p199271/ ebook bookshelf [url=http://audiobookscollection.co.uk/fr/Parole/c3221/]forex ebook 2008[/url] into the wild ebook

Anonymous said...

gen x software http://buyoem.co.uk/es/category-200-214/Otros get free windows software with torrent [url=http://buyoem.co.uk/de/category-100-112/Multimedia-and-Unterhaltung?page=5]what are footprint software[/url] merit 2000 software download
[url=http://buyoem.co.uk/es/category-200-212/Multimedias-y-entretenimiento]Multimedias y entretenimiento - Cheap Legal OEM Software, Software Sale, Download OEM[/url] grammar remediation software
[url=http://buyoem.co.uk/product-12675/Your-Uninstaller-2004pro-v-3][img]http://buyoem.co.uk/image/8.gif[/img][/url]

Anonymous said...

you need a budget software reviews http://buyoemsoftware.co.uk/product-10345/Spss-16-0 gif animation free software [url=http://buyoemsoftware.co.uk/product-37041/Embarcadero-RadPHP-XE2-4-0]optimizer software[/url] government contractors project management software
[url=http://buyoemsoftware.co.uk/product-24184/Roxio-Toast-Ti-Pro-10-Mac]Roxio Toast Ti Pro 10 [Mac] - Cheap Legal OEM Software, Software Sale, Download OEM[/url] orion controlworks 4.0 software
[url=http://buyoemsoftware.co.uk/es/product-25726/Adobe-Creative-Suite-4-Design-Premium][img]http://buyoem.co.uk/image/2.gif[/img][/url]

Anonymous said...

You must also do not forget that you will find few others expenses which come which has a car
like fuel, insurance and maintenance from the car fax payday loan what happens to
the people who use payday cash advances is because keep getting less and fewer with their paycheck because with the interest and charges, virtually kiting them into bankruptcy.

Anonymous said...

This limitation means that you might have a very narrow cause of comparison Pay Day Loans they
could possibly be outright scams or they could possibly be come-ons for several
sorts of loan products, usually payday or advance
loan loans which aren't exactly bad credit loans.

Anonymous said...

So, need to never look towards others when it is possible to't delay your urgent expenses not having sufficient funds with your bank account personal loan in bangalore by developing a more confident, an even more come up with self, you start to make positive changes to attitude about yourself with the same time - not merely your clothes.

Anonymous said...

The differences a wide range of among the technique of
bank loans and internet based payday cash advances payday loan this enables borrowers to assimilate the necessary documentation and apply for
the bad credit loan in a structured and organized
manner.

Anonymous said...

The report which was released this week included an email from -
Bank of Americadiscussing Burk with his fantastic activities
laons this is the reason most financiers have strict rules and policies that
you need to comply.

Anonymous said...

This is to ensure the lending company that his money
wouldn't normally lead to unrecoverable debt payday loan direct lenders only before you begin writing the letter, you will need to perform some important homework.

Anonymous said...



Check out my web blog :: website

Anonymous said...



Feel free to visit my page - webpage

Anonymous said...

A no fax payday loans might be borrowed for a time period of 14 to 31 days signature loans if you select you should
work with a cash advance, borrow only the maximum amount of because you are able to afford to pay for
along with your next paycheck and have enough to generate it for
the next payday.

Anonymous said...

But, this cancelled amount had for ages been considered taxable
No teletrack payday loan companies moreover, you should have to acquire a company form which matches your company to have the advantages of tax treatments.

Anonymous said...

In fact, in case you find Podium and Greenbelt a little classy since several with the stores are top with the
line then NRW will be the same, maybe a lot more payday loans bad credit if she says this happened with the airport with ticket
and visa at hand, it likely is really a scam.

Anonymous said...

As a very first time payday advance customer, you're eligible to gain access to approximately $1500 payday loans columbus ohio lo doc with no doc loans simply need that you can be which you offer an income coming in, and never every one of the mounds of tax statements that banking institutions require.

Anonymous said...

Hi mates, its wonderful article regarding tutoringand completely defined, keep it
up all the time.

Here is my blog post ... breast uplift

Anonymous said...

Excellent article. Keep posting such kind of information on your site.
Im really impressed by your site.
Hey there, You've done a great job. I will definitely digg it and personally suggest to my friends. I'm confident they'll be benefited from this website.

Also visit my blog post: semenax price

Anonymous said...

Wow, fantastic blog layout! How long have you been
blogging for? you make blogging look easy. The overall look of your site is excellent, as well as the content!


Feel free to surf to my page: does semenex work

Anonymous said...

You are so awesome! I don't believe I've read through a single thing like that before.
So wonderful to find someone with some original thoughts on this topic.
Really.. thank you for starting this up.
This web site is something that's needed on the web, someone with a little originality!

Here is my blog: longer lasting erections

Anonymous said...

Hey there, I think your site might be having browser compatibility issues.
When I look at your website in Safari, it looks fine
but when opening in Internet Explorer, it has some overlapping.
I just wanted to give you a quick heads up! Other then that, wonderful
blog!

Feel free to surf to my web page - hhgh

Anonymous said...

I am curious to find out what blog system you
have been utilizing? I'm having some minor security issues with my latest site and I'd like to find something more safe.

Do you have any solutions?

Visit my website; whitening teeth fast

Anonymous said...

Do you have a spam problem on this blog; I
also am a blogger, and I was wanting to know your situation; many of us have developed some nice methods and we are looking to trade
solutions with others, why not shoot me an email if
interested.

My web-site ... eazol review

Anonymous said...

This site really has all of the information and facts I needed about this subject and didn't know who to ask.

Here is my web blog ... human body

Anonymous said...

I was able to find good advice from your blog articles.

Feel free to surf to my blog: gethairatlanta.com

Anonymous said...

You are so cool! I do not think I have read through anything
like that before. So great to discover somebody with a few original thoughts on this topic.
Really.. thanks for starting this up. This site is one thing that
is required on the web, someone with some originality!


my web blog; beep.com

Anonymous said...

Hi there it's me, I am also visiting this site on a regular basis, this web page is really nice and the users are really sharing pleasant thoughts.

My weblog: hoodia works

Anonymous said...

I got this web page from my buddy who told me on the topic of this web
site and now this time I am browsing this website and reading very
informative content at this place.

My page www.laserteacher.com

Anonymous said...

100 free nsa dating http://loveepicentre.com no more dating djs mp3
halifax speed dating [url=http://loveepicentre.com/advice/]dating sties katie[/url] complete free online dating
love hina sim dating cheats [url=http://loveepicentre.com/]united states dating service personals classifieds[/url] speed dating in nashville tn [url=http://loveepicentre.com/user/veronikaqqt7/]veronikaqqt7[/url] search names online dating scams

Anonymous said...

Thank you for another wonderful post. The place else could anybody get
that kind of information in such an ideal manner of writing?
I have a presentation subsequent week, and I'm on the search for such information.

my homepage http://buyvigrxplus.beep.com/

Anonymous said...

profile dating transexual http://loveepicentre.com/map/ dating to girls
novels on interracial dating [url=http://loveepicentre.com/map/]free dating christian sites[/url] meet international dating
dating larger women [url=http://loveepicentre.com/]professional lesbian dating service[/url] kelley earnhardt dating [url=http://loveepicentre.com/user/vovafr/]vovafr[/url] lexington kentucky speed dating

Title Loans Utah said...

I was wanting to know your situation; many of us have developed some nice methods.
Title Loans Utah

Unknown said...

Are you fantasized about interracial dating? Do you want to have a partner from another race or ethnic group? If yes, then you have come to the right place. MixedRelationship.com