我正在尝试制作一个创建饼图的项目
当我点击饼图按钮时出现此错误:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/jfree/util/PublicCloneable
我在项目中使用了这个jar文件:jfreechart-0.9.21.jar
请帮忙吗?!
这是我的代码:
private void pieChartActionPerformed(java.awt.event.ActionEvent evt) {
DefaultPieDataset pieDataset=new DefaultPieDataset();
pieDataset.setValue("first", new Integer(10) );
pieDataset.setValue("second", new Integer(20) );
pieDataset.setValue("third", new Integer(30) );
pieDataset.setValue("fourth", new Integer(40) );
JFreeChart chart = ChartFactory.createPieChart("My Pie Chart", pieDataset, true, true, true);
PiePlot p = (PiePlot)chart.getPlot();
// p.setForegroundAlpha(TOP_ALIGNMENT);
ChartFrame frame = new ChartFrame("Pie Chart!",chart);
frame.setVisible(true);
frame.setSize(450,500);
}