How to add ChartFrame (JFreeChart library) to JFrame (javax.swing library)?

I cannot directly add a ChartFrame object to my Jframe object using the .add (Component) method. And it cannot be done from ChartFrame in JComponent. Listing ChartFrame to Component from java.awt library is also not possible.

How can I add ChartFrame to JFrame in another way?

+1


source to share


2 answers


ChartFrame is a standalone JFrame suitable as an isolated window. If you want to use it as a component, ChartPanel might be the best solution.



+1


source


This would mean inserting a JFrame into another JFrame.

A possible solution would be to use JDesktopPane



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

frame.setContentPane(desktop);

JInternalFrame internalFrame = ...
desktop.add(internalFrame);

      

0


source







All Articles