Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to capture a close event in java swing

I want to capture window close(red X right top position) event. I want to display a specified window upon that window based on the event.

like image 942
user1137559 Avatar asked May 18 '26 15:05

user1137559


1 Answers

Register a WindowListener - specifically, use its windowClosing method:

Invoked when the user attempts to close the window from the window's system menu.

like image 175
ziesemer Avatar answered May 20 '26 03:05

ziesemer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!