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.
How to capture a close event in java swing
Asked Answered
Register a WindowListener
- specifically, use its windowClosing
method:
Invoked when the user attempts to close the window from the window's system menu.
You need to either implement the WindowListener
interface, or register a WindowAdapter
.
Just to add, this tutorial covers an example of implementing a WindowsListener for Close operation docs.oracle.com/javase/tutorial/uiswing/events/… –
Parttime
© 2022 - 2024 — McMap. All rights reserved.