Originariamente inviato da parzi
ho sbagliato a scrivere scusate

la seconda riga di codice del metodo è:

codice:
e.getWindow().dispose();
ho trovato su internet che chiude tutte i processi legati al JFrame e li azzera..
non è corretto???
Dalla documentazione:

"Releases all of the native screen resources used by this Window, its subcomponents, and all of its owned children. That is, the resources for these Components will be destroyed, any memory they consume will be returned to the OS, and they will be marked as undisplayable.
The Window and its subcomponents can be made displayable again by rebuilding the native resources with a subsequent call to pack or show. The states of the recreated Window and its subcomponents will be identical to the states of these objects at the point where the Window was disposed (not accounting for additional modifications between those actions)."

Se tu hai delle tue variabili (che rappresentano lo "stato" della tua istanza) queste non vengono reinizializzate! Devi provvedere tu a farlo!

Esempio: hai un attributo "contatore" che durante l'esecuzione del programma continui ad incrementare. Alla chiusura della finestra vuoi azzerare questo valore: devi essere tu a farlo, se tu non scrivi il codice per farlo il programma non può sapere quello che tu vuoi fare!