Solved

Displaying Chinese Characters in Java Applet

Posted on 2001-08-14
7
746 Views
Last Modified: 2013-12-03
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
Comment
Question by:jerntat
  • 5
  • 2
7 Comments
 
LVL 92

Expert Comment

by:objects
ID: 6383347
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
 

Author Comment

by:jerntat
ID: 6383549
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
 
LVL 92

Expert Comment

by:objects
ID: 6386566
Have you tried setting the component to use your chinese font via setFont().
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

 

Author Comment

by:jerntat
ID: 6386686
no. How do you do that?
0
 
LVL 92

Expert Comment

by:objects
ID: 6386731
component.setFont(mychinesefont);
0
 
LVL 92

Accepted Solution

by:
objects earned 50 total points
ID: 6386745
0
 
LVL 92

Expert Comment

by:objects
ID: 6395302
Thanks for the points :)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
tomcat not starting 6 70
How  Can  I  resolve   this  Error "java.sql.SQLException: Invalid column index" 4 49
ejb stateless example 2 27
jmss example java 2 24
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question