Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using JTextField data to display Chinese Character

807607Dec 23 2006 — edited Dec 25 2006
Hi,

I am new to Java programming, currently using NetBeans for this GUI application that i am developing and I had a problem of displaying a Chinese Character while using the data from JTextField.

==================== P r o b l e m =========================
//hardcoding the following will display a chinese character in the JPanel

Graphics g = null;

g.setFont(new Font("AR PL ZenKai Uni",Font.PLAIN, 32));
g.drawString("\u6c32",100,100);

//However, if i were to use the information from JTextField, i will get \u6c32 if i type that in the JTextField. The following codes illustrates the problem.

Graphics g = null;
String str = new String();

str = jTextField1.getText();
g.setFont(new Font("AR PL ZenKai Uni",Font.PLAIN, 32));
g.drawString(str,100,100);

Please enlighten me, thanks!


Shoker
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 22 2007
Added on Dec 23 2006
15 comments
1,817 views