Monday, March 23, 2009

JFREECHART CLOSING APPLICATIONFRAME


Using JFreeChart? It is very helpful to use JFreeChart for reporting purposes of your system/ programs. However, you may notice that once you incorporate this in your system and you close it, your whole system/ application/ program will also exit or be closed. This is because JFreeCharts usually extends APPLICATIONFRAME that LISTENS to the close button and CLOSES EVERYTHING when clicked. (which is horrible for your system).

Solution?
Just override the windowclosing function!
Like this:

public void windowClosing(final WindowEvent evt){
if(evt.getWindow() == this){
dispose();

}
}


That's all you need :)

----

14 Reactions to this post

Add Comment
  1. Feuhrer said... May 4, 2009 at 1:10 AM

    Thx you helped me alot

  2. pepihno said... May 23, 2009 at 8:35 AM

    thank you veryyyyyyyyyyyyyyy much for this advice,
    You are save my life

    bye from Italy
    :)

  3. tejas said... May 26, 2009 at 2:18 PM

    Thanks a lot! Appreciate it very much :)

  4. jet MUSIC said... July 6, 2009 at 6:10 PM

    welcome to all!!! :D
    i am pleased to help you guys.. ^^,

  5. half said... June 6, 2010 at 8:29 AM

    thanks for this advise! i almost go crazy! xD

  6. Anonymous said... June 14, 2010 at 5:19 PM

    Perfect!
    thanks!

  7. jet MUSIC said... June 23, 2010 at 8:03 PM

    welcome :) thanks for dropping by here :D

  8. Nikola Rankovic said... September 4, 2010 at 6:19 PM

    OMG thank you so much for this great idea! I've been facepalming for like 2 hours now searching for a solution... :D

  9. jet MUSIC said... March 18, 2011 at 2:25 AM

    welcome, im glad to help :)

  10. Lee Wei said... November 26, 2012 at 11:52 PM

    Thank you very much, this has helped me in my project work greatly.

  11. Anonymous said... May 4, 2013 at 5:05 AM

    THANKS!!!!!

  12. Key Hunters said... May 28, 2013 at 9:13 AM

    Thank you thank you thank you! You solved my problem in a minute! Kiiisseees!!!

  13. Tom said... June 24, 2014 at 2:39 AM

    Thanks, you're great!

  14. Sean said... January 13, 2017 at 7:55 AM

    This fantastic, thank you