Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 794
  • Last Modified:

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. ?

0
jerntat
Asked:
jerntat
  • 5
  • 2
1 Solution
 
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
 
objectsCommented:
Have you tried setting the component to use your chinese font via setFont().
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
jerntatAuthor Commented:
no. How do you do that?
0
 
objectsCommented:
component.setFont(mychinesefont);
0
 
objectsCommented:
Thanks for the points :)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now