Search code examples
javajfreechart

jfreechart panelChart can't find symbol


So I've imported the following to the needed library already. But panelChart can't find symbol. Tried creating a new file on desktop and then copying from the file on desktop but it still did not work. Tried absolute path and it also did not change anything.

hamcrest-core-1.3.jar
jcommon-1.0.23.jar
jfreechart-1.0.19-experimental.jar
jfreechart-1.0.19-swt.jar
jfreechart-1.0.19.jar
jfreesvg-2.0.jar
junit-4.11.jar
orsoncharts-1.4-eval-nofx.jar
orsonpdf-1.6-eval.jar
servlet.jar
swtgraphics2d.jar

Also, already directly imported the following into the class.

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;

panelChart.removeALL();
panelChart.add(barPanel,BorderLayout.CENTER );
panelChart.validate();

panelChart is underlined in red


Solution

  • I was following a video guide, and I did not realize he had renamed his JPanel from the default name to panelChart. In case you are following a similar video and run into the same problem, just change the variable name to panelChart from, usually, jPanel1, jPanel2 etc.