Closing a swinging window jfreechart closes the entire application

I have included this Jfreechart Bar Demo with my swing app. I put the following code into the action performed by the button method, 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 creates a chart. But when you close the chart window. My whole application is closing.

I tried to insert demo.getDefaultCloseOperation(ApplicationFrame.DISPOSE_ON_CLOSE); but it does not work. Although this does not give any errors.

I also tried pasting this into the BarChart3DDemo3 constructor, but its getDefaultCloseOperation () method does not accept an int argument.

I do not know what to do next? Please help. Thank you

+5
source share
3 answers

, ApplicationFrame " , JVM." . ChartPanel JFrame, .

+11

LineChart_AWT ApplicationFrame,

LineChart_AWT extends JFrame .

0

, : Myclass ApplicationFrame. ApplicationFrame JFrame.

0

All Articles