Closed emn23 closed 8 years ago
Hmm. This has to be a typo in Prof. Ramirez's code. DO_NOTHING_ON_CLOSE means what it says, "do nothing when you close it using the normal close button". Usually this is because you want to have your own "Exit" button (http://docs.oracle.com/javase/7/docs/api/javax/swing/WindowConstants.html#DO_NOTHING_ON_CLOSE) If you want closing the window to close the application, you use EXIT_ON_CLOSE.
If you try to run ex15a, you will note that clicking the red "close" button on OS X (and presumably the X on a Windows machine) will not cause the program to exit.
Let me know if this answers your question.
Professor Laboon,
Just wanted to clarify the action to end a graphical program. On your FrameDemo.java (lines 22/23) you used EXIT.ON.CLOSE to terminate the program when the window closes; however, in Prof. Ramirez's ex15a.java handout he use's DO.NOTHING.ON.CLOSE to try to do the same thing. Your example would be the correct way, right?
Thanks for the help.