File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Can't display chinese and japanese at the same time (Urgent!!!!) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Can Watch "Can New topic
Author

Can't display chinese and japanese at the same time (Urgent!!!!)

S Dan
Greenhorn

Joined: Apr 05, 2005
Posts: 25
Ok, the following program tries to display a string that contains mostly japanese characters along with few chinese characters.
When I try "java I18NTest zh ZH" it shows all japanese and chinese characters properly except one.
When I try "java I18NTest ja JA" its shows the japanese fine but messes up the chinese characters.
What do I have to do so that it displays all japanese and chinese characters properly? Following is the java code and the .properties files (both the properties files are same though). I'm sure that the problem has nothing
to do with system fonts as there is a third party java application that shows those characters properly on my machine. Any help will really be appreciated.
Thanks.
-Dan

*******************************************************************
I18NTest.java

import javax.swing.*;
import java.awt.*;
import java.util.*;

public class I18NTest {
public static void main(String args[]) {

String language;
String country;

if (args.length != 2) {
language = new String("en");
country = new String("US");
} else {
language = new String(args[0]);
country = new String(args[1]);
}

Locale currentLocale;
ResourceBundle messages;

currentLocale = new Locale(language, country);
System.getProperties().put("user.language",language);
messages =
ResourceBundle.getBundle("MessagesBundle",currentLocale);

Object rows[][] = {
{"test", messages.getString("test")}
};
Object headers[] = {"L","R"};
JFrame frame = new JFrame("Sample");
JTable table = new JTable(rows, headers);
JScrollPane scrollPane = new JScrollPane(table);
frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
frame.setSize(300, 150);
frame.setVisible(true);
}
}
*******************************************************************
MessagesBundle_ja_JA.properties

test=\u4E2D\u56FD\u8BED\u9891\u9053\u3A00\u2000\u94C3\u6728
*******************************************************************
MessagesBundle_zh_ZH.properties

test=\u4E2D\u56FD\u8BED\u9891\u9053\u3A00\u2000\u94C3\u6728


[ November 01, 2005: Message edited by: S Dan ]

[ November 01, 2005: Message edited by: S Dan ]
[ November 03, 2005: Message edited by: S Dan ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Can't display chinese and japanese at the same time (Urgent!!!!)
 
Similar Threads
JTable printing . . .
Scrollbar for jtable
Locale methods - Strange Behavior
jtable
Posting it again (Urgent!) Can't display chinese and japanese font at the same time