如题:
用word新建一个空文档,输入一排英中文混排的文字,另存为rtf文件:c:\test.rtf。
JEditorPane jEditorPane1 = new JEditorPane();
jEditorPane1.setContentType("text/rtf");
File file = new File ("c:/test.rtf");
String str = file.getAbsolutePath();
str = "file:"+str;
jEditorPane1.setPage(str);
jEditorPane1.setEditable(false);
JFrame jframe = new JFrame("test");
jframe.setContentPane(jEditorPane1);
jframe.setBounds(0,0,100,100);
jframe.setVisible(true);显示出来的英文字符正确,中文乱码。
用word新建一个空文档,输入一排英中文混排的文字,另存为rtf文件:c:\test.rtf。
JEditorPane jEditorPane1 = new JEditorPane();
jEditorPane1.setContentType("text/rtf");
File file = new File ("c:/test.rtf");
String str = file.getAbsolutePath();
str = "file:"+str;
jEditorPane1.setPage(str);
jEditorPane1.setEditable(false);
JFrame jframe = new JFrame("test");
jframe.setContentPane(jEditorPane1);
jframe.setBounds(0,0,100,100);
jframe.setVisible(true);显示出来的英文字符正确,中文乱码。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货