java - How can a JComponent notified about the closed event of it's parent J(Internal)Frame? -


I want to write a component that monitors other activities, but when the component window is closed the listener is removed is. / P>

I do not want to write this removal code many times, but want to handle component manually. (How can I do this)?

Thank you!

JFrame class (which is the window) in a processWindowEvent < / Code> Callback that takes a parameter called Windowevent

register this callback and if the parameter is of WINDOW_CLOSED , then You can call the removal code from inside.

Finally, the removal code is written only once (as you wish).

Look for more details.

Update: Also see


Comments