Anonymous asked in Computers & InternetProgramming & Design · 8 years ago

java JFrame.EXIT_ON_CLOSE?

what is the difference between JFrame.EXIT_ON_CLOSE and JFrame.DISPOSE_ON_CLOSE?

which one do i need to use and when?

5 Answers

  • 8 years ago
    Favorite Answer

    EXIT_ON_CLOSE will exit your program, vs DISPOSE_ON_CLOSE which will just close that JFrame. So if you have a program that has a main window and can make child windows you would want the main to EXIT_ON_CLOSE which would kill your program, and the children to DISPOSE_ON_CLOSE so that only that child window is closed, your program keeps running, and the main window stays open

    • Login to reply the answers
  • 6 years ago

    Dispose closes the JFrame and clears up the memory while Exit closes the main window when the JFrame is closed by clicking on close button...

    • Login to reply the answers
  • alcime
    Lv 4
    3 years ago


    • Login to reply the answers
  • Anonymous
    6 years ago

    don't know what to answer

    • Login to reply the answers
  • How do you think about the answers? You can sign in to vote the answer.
  • 8 years ago

    k ok

    • Login to reply the answers
Still have questions? Get your answers by asking now.