I have integrated this Jfreechart Bar Demo with my swing application. I have put the following code in the action performed method of a button, this code was previously in the main method of the Bar Demo class.
final BarChart3DDemo3 demo = new BarChart3DDemo3("3D Bar Chart Demo 3");
demo.pack();
RefineryUtilities.centerFrameOnScreen(demo);
demo.setVisible(true);
This is generating the Bar Chart. But on closing the Bar chart Window. My Whole application is getting closed.
I have tried to insert demo.getDefaultCloseOperation(ApplicationFrame.DISPOSE_ON_CLOSE);
but its not working. Although not giving any error.
I have also tried to insert this in the BarChart3DDemo3 constructor but its giving error getDefaultCloseOperation() method does not take int argument.
I have no clue what to do next? Please help. Thanks.
Note that ApplicationFrame
"listens for window closing events, and responds by shutting down the JVM." It's intended for demo applications. Instead, put your ChartPanel
in a JFrame
, as shown here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With