views:

1008

answers:

2

I can't directly add ChartFrame object to my Jframe object with .add(Component) method. And it's not possible to cast from ChartFrame to JComponent. Casting ChartFrame to Component from java.awt library is also impossible.

How can I add ChartFrame to JFrame the other way?

A: 

That would mean inserting a JFrame within another JFrame.

A possible solution would be to use a JDesktopPane

JDesktopPane desktop = ...
JFrame frame = ...

frame.setContentPane(desktop);

JInternalFrame internalFrame = ...
desktop.add(internalFrame);
VonC
+1  A: 

ChartFrame is an independent JFrame, suitable as an isolated window. If you want to use it as a component, ChartPanel may be a better solution.

luiscubal