Displaying Chinese Characters in Java Applet

Hello, does anybody know how to display chinese characters on an applet's GUI? I try to just input chinese unicode in the various GUI components but it sometimes comes out as unicode characters and if if use a chinese viewer program, it comes out as squares.

Is there anyway to have chinese character display in an applet without the use of any external chinese viewer program such as NJStar etc. ?

jerntatAsked:
Who is Participating?
 
objectsCommented:
You need to have the necessary fonts installed not only on your machine but also in the jre being used.
There is doco at java.sun.com on how to make fonts available to the jre.
0
 
jerntatAuthor Commented:
I have already done that but didnt get anything out.I have tested on the following code:

public class TestApplet extends JApplet
{
  public void init(){
  }

  public void start(){
    String abc = "\u4f60\u597d\u4e16\u754c";
    JOptionPane.showMessageDialog(null, abc);
  }
}

I have also tried compiling using encoding.
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
objectsCommented:
Have you tried setting the component to use your chinese font via setFont().
0
 
jerntatAuthor Commented:
no. How do you do that?
0
 
objectsCommented:
component.setFont(mychinesefont);
0
 
objectsCommented:
Thanks for the points :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.