紧急求助:为何无法显示中文?
我用的是中文Win98,jdk1.1.8、jdk1.2和jdk1.4都不行
请看以下代码:
import java.awt.*;
import java.util.*;
class t1
{public t1()
{Frame f=new Frame( "test ");
Locale currentLocale;
ResourceBundle messages;
currentLocale = new Locale( "zh ", "CN ");
messages = ResourceBundle.getBundle( "MessagesBundle ",currentLocale);
Button b=new Button(messages.getString( "greetings "));
f.add(b, "Center "); f.pack(); f.setVisible(true);
}
public static void main(String args[])
{new t1();}
}
另有MessagesBundle_zh_CN.properties文件:
greetings = 你好
------解决方案--------------------将资源文件转换成ascii编码就可以了
用netive2ascii指令