This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Displaying Unicode in AWT components Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Displaying Unicode in AWT components" Watch "Displaying Unicode in AWT components" New topic
Author

Displaying Unicode in AWT components

Chiaw Huat Lee
Greenhorn

Joined: Oct 24, 2004
Posts: 15
Hi,

I have this problem on displaying chinese char on my awt button.
Not sure whether I'm doing it correctly but, when I run my applet (which contain the frame that contain the button), it will NOT be able to display it (Using Sun JVM).
But, if I'm using Microsoft JVM, it will able to display it.
Btw, the Font type that I use is Dialog. Did try on other Font type that been supported by the browser (IE), M JVM and Sun JVM like, SimSun, SansSerif,etc...
Below is the code on how I do it.
.....
Font font = new Font("Dialog", Font.PLAIN, 12);

Button addButton = new Button();
addButton.setFont(font);
addButton.setLabel("\u6E05\u9664");

.....

As far as I know is, diff browser will have diff Font type that been supported by them.For example, IE only support Font type of SinSun, SinHei,NSinSun, and Microsoft Sans Serif....and I have try all the font type, still can't able to work it out. Hope you guys can share with me, what are the things that I miss out. Thank you.

Btw, I am forced to use awt. So, please don't suggest me to use Swing components. Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Displaying Unicode in AWT components
 
Similar Threads
JVM vs JRE vs Java Plug-In and Yahoo Chat!
applet, IE and Microsoft VM
MenuItem font setting
Jasper Reports Problem
Unicode in TextArea