01: package abbot.editor.recorder;
02:
03: import java.awt.AWTEvent;
04: import java.awt.event.*;
05:
06: import javax.swing.JInternalFrame;
07: import javax.swing.event.*;
08:
09: public abstract class AbstractInternalFrameWatcher extends
10: InternalFrameAdapter implements ComponentListener {
11: public AbstractInternalFrameWatcher(JInternalFrame f) {
12: f.addInternalFrameListener(this );
13: f.addComponentListener(this );
14: }
15:
16: protected abstract void dispatch(AWTEvent e);
17:
18: public void componentHidden(ComponentEvent e) {
19: // Ensure this listener doesn't hang around after the frame goes
20: // away.
21: e.getComponent().removeComponentListener(this );
22: ((JInternalFrame) e.getComponent())
23: .removeInternalFrameListener(this );
24: }
25:
26: public void internalFrameClosing(InternalFrameEvent e) {
27: dispatch(e);
28: e.getInternalFrame().removeInternalFrameListener(this );
29: e.getInternalFrame().removeComponentListener(this );
30: }
31:
32: public void internalFrameIconified(InternalFrameEvent e) {
33: dispatch(e);
34: }
35:
36: public void internalFrameDeiconified(InternalFrameEvent e) {
37: dispatch(e);
38: }
39:
40: public void componentShown(ComponentEvent e) {
41: }
42:
43: public void componentResized(ComponentEvent e) {
44: }
45:
46: public void componentMoved(ComponentEvent e) {
47: }
48: }
|