In my Java application, I just use two different panels named as Panel1
, Panel2
. Both panels have their own ChartPanel
from JFreeChart
to generate dynamic chart. If I want to clear this by using,
if(Panel1.getComponentCount() != 0) Panel1.remove(Graph.CPanel);
if(Panel2.getComponentCount() != 0) Panel2.remove(Graph1.CPanel1);
Panel1.repaint();
Panel2.repaint();
the above code mean, it just remove panel one content. Panel two still show the chart panel, but that's not running. Why panel two didn't remove its content?