I was develope my application by netbean. My application is setdefaultcloseoperation EXIT_ON_CLOSE. My application call jfreechart as a child frame when jfreechart activate, I close it but my application will close too. I want close the child but i did not close my application. How I do? Where I set the close operation for the child? this is my code that call the child jfreechart
" Timeseries_two demo = new Timeseries_two("กราฟแสดงการเปรียบเทียบหุ้น");
demo.pack();
RefineryUtilities.centerFrameOnScreen(demo);
demo.setVisible(true);
"
i add this to the code but it not effect. "demo.setDefaultCloseOperation(DISPOSE_ON_CLOSE); "
Please, help me.... thank you
I have a problem about close jfreechart frame.
Re: I have a problem about close jfreechart frame.
I am new to jfreechart and also need to close the chart and not exit the application that called the chart.
Like the original poster, I think DISPOSE_ON_CLOSE needs to be the default close operation, but I don't see how to tell the frame (using the modified demo bar chart for testing).
Any help would be appreciated.
Bill
Like the original poster, I think DISPOSE_ON_CLOSE needs to be the default close operation, but I don't see how to tell the frame (using the modified demo bar chart for testing).
Any help would be appreciated.
Bill
-
- Posts: 31
- Joined: Thu May 27, 2010 4:23 pm
- antibot: No, of course not.
Re: I have a problem about close jfreechart frame.
#setDefaultCloseOperation is a method of a JFrame not a method of your application. So you need to call:
like bhogsett suggested. You are likely setting EXIT_ON_CLOSE for both of your frames.
Cheers,
- m
Code: Select all
mainFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
.....
childFrame.setDefaultCloseOperation(WindowConstant.DISPOSE_ON_CLOSE);
Cheers,
- m