Replacing an existing jPanel with a new jPanel



Hi everybody,

I'm working on a project and basically I've developed a swing GUI
using NetBeans Swing GUI builder. On one form, I have an existing
JPanel that contains no other components. Also on this form, I have a
button that when pressed executes a function of another Class that
creates a graph (using jFreeChart) and returns the graph on a JPanel.
My question is: Is it possible to replace the existing JPanel on the
aforementioned form with the JPanel returned from the graphing method
such that I can dynamically place the created graph on the form?

I'm not sure exactly how to go about doing this. I know that I can
take the JPanel containing the graph and show it on another frame by
creating and new frame and showing it. However my desire is to have
the graph be part of the existing form in the location where the
existing JPanel lies.

Any help would be very much appreciated.

Thanks.

Brian
.