jfreechart中出现中文边白色框的乱码解决办法,看了下源码如下:
jfreechart包中:
在StandardChartTheme类中定义了默认字体为Tahoma;
public StandardChartTheme(String name) {
if (name == null) {
throw new IllegalArgumentException("Null 'name' argument.");
}
this.name = name;
this.extraLargeFont = new Font("Tahoma", Font.BOLD, 20);
this.largeFont = new Font("Tahoma", Font.BOLD, 14);
this.regularFont = new Font("Tahoma", Font.PLAIN, 12);
this.smallFont = new Font("Tahoma", Font.PLAIN, 10);
this.titlePaint = Color.black;
this.subtitlePaint = Color.black;
this.legendBackgroundPaint = Color.white;
处理办法,将默认字体修改为您想要的字体即可。
由于jfreechart是开源的项目,最直接的就是下个源码文件,在源代码中作修改。然后自己打个jar包,搞定。
个人修改了该字体为“宋体”。并作了打包,不过是普通的用myEclise打的包,有需要的朋友可以拿来用。不知道有没有上传错包,呵呵。
jfreechart包中:
在StandardChartTheme类中定义了默认字体为Tahoma;
public StandardChartTheme(String name) {
if (name == null) {
throw new IllegalArgumentException("Null 'name' argument.");
}
this.name = name;
this.extraLargeFont = new Font("Tahoma", Font.BOLD, 20);
this.largeFont = new Font("Tahoma", Font.BOLD, 14);
this.regularFont = new Font("Tahoma", Font.PLAIN, 12);
this.smallFont = new Font("Tahoma", Font.PLAIN, 10);
this.titlePaint = Color.black;
this.subtitlePaint = Color.black;
this.legendBackgroundPaint = Color.white;
处理办法,将默认字体修改为您想要的字体即可。
由于jfreechart是开源的项目,最直接的就是下个源码文件,在源代码中作修改。然后自己打个jar包,搞定。
个人修改了该字体为“宋体”。并作了打包,不过是普通的用myEclise打的包,有需要的朋友可以拿来用。不知道有没有上传错包,呵呵。