Closing and disposing a JFrame and ChartPanel

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
sturodgers
Posts: 6
Joined: Fri Aug 17, 2007 5:43 pm

Closing and disposing a JFrame and ChartPanel

Post by sturodgers » Mon May 12, 2008 9:29 pm

In my application, the user can create and use multiple charts simultaneously. Currently, each chart is in its own JFrame with DISPOSE_ON_CLOSE set as its default close action.

When closing and disposing of a JFrame and ChartPanel,
is a call to dispose() sufficient to free up all resources, listeners, etc, or should I handle all the calls to components (such as the plot, the data series, tool tip generator, url generator, axis, etc) individually?

Thank you,
Stu

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Mon May 12, 2008 9:34 pm

As long as you don't keep any other references to the chart or its subcomponents, then disposing of the JFrame / ChartPanel should be enough to let the garbage collector do its work.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked