01: package org.rapla.gui.toolkit;
02:
03: import java.awt.event.WindowAdapter;
04: import java.awt.event.WindowEvent;
05: import org.apache.avalon.framework.container.ContainerUtil;
06:
07: /** Disposes an object on window close. Must be added as a WindowListener
08: to the target window*/
09: final public class DisposingTool extends WindowAdapter {
10: Object m_objectToDispose;
11:
12: public DisposingTool(Object objectToDispose) {
13: m_objectToDispose = objectToDispose;
14: }
15:
16: public void windowClosed(WindowEvent e) {
17: ContainerUtil.dispose(m_objectToDispose);
18: }
19: }
|