Finding out when a component is "destroyed"
797060Aug 26 2010 — edited Aug 31 2010I have a container (extends Container) that holds a few components, When one of these components (specifically a panel showing a video) is destroyed, or the whole container, I would like to call a JNI method disconnecting the camera.
Now, the container is in a JFrame, I could add a window listener to this to detect when the user closes the window, but in the future I will probably add this container to a different window, and in the interest of ease of use later on and encapsulation and all that I don't want to have to add a window listener with a destroy method to everything the container is placed in in the future - It should handel everything itself right?
So far I have tried a ContainerListener for a componentRemoved event, figuring it might remove the components when it gets cleaned up on close - but it doesn't get called. Can anyone help?