wood burning stoves
The moose likes Swing / AWT / SWT and the fly likes Japanse font (Urgent! Please help) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Japanse font (Urgent! Please help)" Watch "Japanse font (Urgent! Please help)" New topic

Japanse font (Urgent! Please help)

S Dan

Joined: Apr 05, 2005
Posts: 25
I'm trying to set text to a JLabel. Suppose I have a string variable called
"description". "description" contains japanese characters.
when I use jLabel.setText(description), it works fine and shows the japanese
fonts properly. Now if I try to wrap the description with html tags..e.g

jLabel.setText("<html><body><font FACE=\"sans-serif, Arial, Helvetica, Geneva\">"+description+"</font></body></html>");

then it just messes the japanse fonts. Why is that so? How can I wrap that in html?
Thanks in advance.
Pat Hays
Ranch Hand

Joined: Aug 20, 2004
Posts: 138
Hi S Dan

I am not sure whether this would help you, but u could try it.

(If u are using WindowsOS) Go to Control Panel => Date, Time, Language, and Regional Options => Regional and Language Options, then choose Japanese as Standards and formats Setting. Hope it works for u.

Download Java GUI Builder, <a href="http://www.mars3000.com" target="_blank" rel="nofollow">http://www.mars3000.com</a>
Jared Cope
Ranch Hand

Joined: Aug 18, 2004
Posts: 243

I would find out what font your JLabel uses to do it's display with. You are explicitly giving the HTML a list of fonts to choose from, but perhaps those fonts don't support Japanese characters.

I know that I have to use a special font in order to make chinese characters appear properly in my swing app, otherwise I get boxes where the characters should be.

Cheers, Jared.

SCJP 1.4 91%, SCJP 1.5 88%, SCJD B&S
I agree. Here's the link: http://aspose.com/file-tools
subject: Japanse font (Urgent! Please help)
It's not a secret anymore!