最新版本的jfreechart因为默认不支持中文显示,每次都得设置中文字体,为方便只需修改jfreechart-1.0.19.jar包中org\jfree\chartStandardChartTheme.class,根据源代码修改构造方法StandardChartTheme(String name, boolean shadow)中
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.extraLargeFont = new Font("SansSerif", 1, 20);
this.largeFont = new Font("SansSerif", 1, 14);
this.regularFont = new Font("SansSerif", 0, 12);
this.smallFont = new Font("SansSerif", 0, 10);
后编译替换jar文件中对应class文件,不要尝试编译完整源码,缺少文件,无法完整编译,只需编译该类替换就好了
在工程中使用修改后的jar文件即可不需要每次设置中文了。