Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between dispose and exit on close in java

Tags:

java

I have a single frame created using Netbeans GUI builder when I view the frame properties one of the first options is default close operation the options listed are: DISPOSE_ON_CLOSE, HIDE_ON_CLOSE, DO_NOTHING_ON_CLOSE & EXIT_ON_CLOSE I understand the middle two but, whats the difference between DISPOSE_ON_CLOSE and EXIT_ON_CLOSE ? I have tried testing both but to me they do the same thing to me

like image 316
Ayvadia Avatar asked Oct 17 '13 17:10

Ayvadia


1 Answers

EXIT_ON_CLOSE will terminate the program.

DISPOSE_ON_CLOSE will call dispose() on the frame, which will make it disappear and remove the resources it is using. You cannot bring it back, unlike hiding it.

See aslo JFrame.dispose() vs System.exit()

like image 127
Garrett Hall Avatar answered Sep 30 '22 12:09

Garrett Hall