Skip to content

Commit 9e97566

Browse files
committed
fixes missing Internal frame event classes
1 parent 1567e4a commit 9e97566

File tree

4 files changed

+359
-0
lines changed

4 files changed

+359
-0
lines changed
1.47 MB
Binary file not shown.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
* Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
26+
package javax.swing.event;
27+
28+
/**
29+
* An abstract adapter class for receiving internal frame events.
30+
* The methods in this class are empty. This class exists as
31+
* convenience for creating listener objects, and is functionally
32+
* equivalent to the WindowAdapter class in the AWT.
33+
* <p>
34+
* See <a href="http://java.sun.com/docs/books/tutorial/uiswing/events/internalframelistener.html">How to Write an Internal Frame Listener</a>
35+
* in <em>The Java Tutorial</em> and
36+
* <a href="http://www.awl.com/cp/javaseries/jcl1_2.html">The Java Class Libraries (update)</a>
37+
*
38+
* @see InternalFrameEvent
39+
* @see InternalFrameListener
40+
* @see java.awt.event.WindowListener
41+
*
42+
* @author Thomas Ball
43+
*/
44+
public abstract class InternalFrameAdapter implements InternalFrameListener {
45+
/**
46+
* Invoked when an internal frame has been opened.
47+
*/
48+
public void internalFrameOpened(InternalFrameEvent e) {}
49+
50+
/**
51+
* Invoked when an internal frame is in the process of being closed.
52+
* The close operation can be overridden at this point.
53+
*/
54+
public void internalFrameClosing(InternalFrameEvent e) {}
55+
56+
/**
57+
* Invoked when an internal frame has been closed.
58+
*/
59+
public void internalFrameClosed(InternalFrameEvent e) {}
60+
61+
/**
62+
* Invoked when an internal frame is iconified.
63+
*/
64+
public void internalFrameIconified(InternalFrameEvent e) {}
65+
66+
/**
67+
* Invoked when an internal frame is de-iconified.
68+
*/
69+
public void internalFrameDeiconified(InternalFrameEvent e) {}
70+
71+
/**
72+
* Invoked when an internal frame is activated.
73+
*/
74+
public void internalFrameActivated(InternalFrameEvent e) {}
75+
76+
/**
77+
* Invoked when an internal frame is de-activated.
78+
*/
79+
public void internalFrameDeactivated(InternalFrameEvent e) {}
80+
}
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
/*
2+
* Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
package javax.swing.event;
26+
27+
import java.awt.AWTEvent;
28+
import javax.swing.JInternalFrame;
29+
30+
/**
31+
* An <code>AWTEvent</code> that adds support for
32+
* <code>JInternalFrame</code> objects as the event source. This class has the
33+
* same event types as <code>WindowEvent</code>,
34+
* although different IDs are used.
35+
* Help on handling internal frame events
36+
* is in
37+
* <a href="http://java.sun.com/docs/books/tutorial/uiswing/events/internalframelistener.html" target="_top">How to Write an Internal Frame Listener</a>,
38+
* a section in <em>The Java Tutorial</em>.
39+
* <p>
40+
* <strong>Warning:</strong>
41+
* Serialized objects of this class will not be compatible with
42+
* future Swing releases. The current serialization support is
43+
* appropriate for short term storage or RMI between applications running
44+
* the same version of Swing. As of 1.4, support for long term storage
45+
* of all JavaBeans<sup><font size="-2">TM</font></sup>
46+
* has been added to the <code>java.beans</code> package.
47+
* Please see {@link java.beans.XMLEncoder}.
48+
*
49+
* @see java.awt.event.WindowEvent
50+
* @see java.awt.event.WindowListener
51+
* @see JInternalFrame
52+
* @see InternalFrameListener
53+
*
54+
* @author Thomas Ball
55+
*/
56+
public class InternalFrameEvent extends AWTEvent {
57+
58+
/**
59+
* The first number in the range of IDs used for internal frame events.
60+
*/
61+
public static final int INTERNAL_FRAME_FIRST = 25549;
62+
63+
/**
64+
* The last number in the range of IDs used for internal frame events.
65+
*/
66+
public static final int INTERNAL_FRAME_LAST = 25555;
67+
68+
/**
69+
* The "window opened" event. This event is delivered only
70+
* the first time the internal frame is made visible.
71+
*
72+
* @see JInternalFrame#show
73+
*/
74+
public static final int INTERNAL_FRAME_OPENED = INTERNAL_FRAME_FIRST;
75+
76+
/**
77+
* The "window is closing" event. This event is delivered when
78+
* the user attempts to close the internal frame, such as by
79+
* clicking the internal frame's close button,
80+
* or when a program attempts to close the internal frame
81+
* by invoking the <code>setClosed</code> method.
82+
*
83+
* @see JInternalFrame#setDefaultCloseOperation
84+
* @see JInternalFrame#doDefaultCloseAction
85+
* @see JInternalFrame#setClosed
86+
*/
87+
public static final int INTERNAL_FRAME_CLOSING = 1 + INTERNAL_FRAME_FIRST;
88+
89+
/**
90+
* The "window closed" event. This event is delivered after
91+
* the internal frame has been closed as the result of a call to
92+
* the <code>setClosed</code> or
93+
* <code>dispose</code> method.
94+
*
95+
* @see JInternalFrame#setClosed
96+
* @see JInternalFrame#dispose
97+
*/
98+
public static final int INTERNAL_FRAME_CLOSED = 2 + INTERNAL_FRAME_FIRST;
99+
100+
/**
101+
* The "window iconified" event.
102+
* This event indicates that the internal frame
103+
* was shrunk down to a small icon.
104+
*
105+
* @see JInternalFrame#setIcon
106+
*/
107+
public static final int INTERNAL_FRAME_ICONIFIED = 3 + INTERNAL_FRAME_FIRST;
108+
109+
/**
110+
* The "window deiconified" event type. This event indicates that the
111+
* internal frame has been restored to its normal size.
112+
*
113+
* @see JInternalFrame#setIcon
114+
*/
115+
public static final int INTERNAL_FRAME_DEICONIFIED = 4 + INTERNAL_FRAME_FIRST;
116+
117+
/**
118+
* The "window activated" event type. This event indicates that keystrokes
119+
* and mouse clicks are directed towards this internal frame.
120+
*
121+
* @see JInternalFrame#show
122+
* @see JInternalFrame#setSelected
123+
*/
124+
public static final int INTERNAL_FRAME_ACTIVATED = 5 + INTERNAL_FRAME_FIRST;
125+
126+
/**
127+
* The "window deactivated" event type. This event indicates that keystrokes
128+
* and mouse clicks are no longer directed to the internal frame.
129+
*
130+
* @see JInternalFrame#setSelected
131+
*/
132+
public static final int INTERNAL_FRAME_DEACTIVATED = 6 + INTERNAL_FRAME_FIRST;
133+
134+
/**
135+
* Constructs an <code>InternalFrameEvent</code> object.
136+
* @param source the <code>JInternalFrame</code> object that originated the event
137+
* @param id an integer indicating the type of event
138+
*/
139+
public InternalFrameEvent(JInternalFrame source, int id) {
140+
super(source, id);
141+
}
142+
143+
/**
144+
* Returns a parameter string identifying this event.
145+
* This method is useful for event logging and for debugging.
146+
*
147+
* @return a string identifying the event and its attributes
148+
*/
149+
public String paramString() {
150+
String typeStr;
151+
switch(id) {
152+
case INTERNAL_FRAME_OPENED:
153+
typeStr = "INTERNAL_FRAME_OPENED";
154+
break;
155+
case INTERNAL_FRAME_CLOSING:
156+
typeStr = "INTERNAL_FRAME_CLOSING";
157+
break;
158+
case INTERNAL_FRAME_CLOSED:
159+
typeStr = "INTERNAL_FRAME_CLOSED";
160+
break;
161+
case INTERNAL_FRAME_ICONIFIED:
162+
typeStr = "INTERNAL_FRAME_ICONIFIED";
163+
break;
164+
case INTERNAL_FRAME_DEICONIFIED:
165+
typeStr = "INTERNAL_FRAME_DEICONIFIED";
166+
break;
167+
case INTERNAL_FRAME_ACTIVATED:
168+
typeStr = "INTERNAL_FRAME_ACTIVATED";
169+
break;
170+
case INTERNAL_FRAME_DEACTIVATED:
171+
typeStr = "INTERNAL_FRAME_DEACTIVATED";
172+
break;
173+
default:
174+
typeStr = "unknown type";
175+
}
176+
return typeStr;
177+
}
178+
179+
180+
/**
181+
* Returns the originator of the event.
182+
*
183+
* @return the <code>JInternalFrame</code> object that originated the event
184+
* @since 1.3
185+
*/
186+
187+
public JInternalFrame getInternalFrame () {
188+
return (source instanceof JInternalFrame)? (JInternalFrame)source : null;
189+
}
190+
191+
192+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/*
2+
* Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
26+
package javax.swing.event;
27+
28+
import java.util.EventListener;
29+
30+
/**
31+
* The listener interface for receiving internal frame events.
32+
* This class is functionally equivalent to the WindowListener class
33+
* in the AWT.
34+
* <p>
35+
* See <a href="http://java.sun.com/docs/books/tutorial/uiswing/events/internalframelistener.html">How to Write an Internal Frame Listener</a>
36+
* in <em>The Java Tutorial</em> and
37+
* <a href="http://www.awl.com/cp/javaseries/jcl1_2.html">The Java Class Libraries (update)</a>
38+
* for further documentation.
39+
*
40+
* @see java.awt.event.WindowListener
41+
*
42+
* @author Thomas Ball
43+
*/
44+
public interface InternalFrameListener extends EventListener {
45+
/**
46+
* Invoked when a internal frame has been opened.
47+
* @see javax.swing.JInternalFrame#show
48+
*/
49+
public void internalFrameOpened(InternalFrameEvent e);
50+
51+
/**
52+
* Invoked when an internal frame is in the process of being closed.
53+
* The close operation can be overridden at this point.
54+
* @see javax.swing.JInternalFrame#setDefaultCloseOperation
55+
*/
56+
public void internalFrameClosing(InternalFrameEvent e);
57+
58+
/**
59+
* Invoked when an internal frame has been closed.
60+
* @see javax.swing.JInternalFrame#setClosed
61+
*/
62+
public void internalFrameClosed(InternalFrameEvent e);
63+
64+
/**
65+
* Invoked when an internal frame is iconified.
66+
* @see javax.swing.JInternalFrame#setIcon
67+
*/
68+
public void internalFrameIconified(InternalFrameEvent e);
69+
70+
/**
71+
* Invoked when an internal frame is de-iconified.
72+
* @see javax.swing.JInternalFrame#setIcon
73+
*/
74+
public void internalFrameDeiconified(InternalFrameEvent e);
75+
76+
/**
77+
* Invoked when an internal frame is activated.
78+
* @see javax.swing.JInternalFrame#setSelected
79+
*/
80+
public void internalFrameActivated(InternalFrameEvent e);
81+
82+
/**
83+
* Invoked when an internal frame is de-activated.
84+
* @see javax.swing.JInternalFrame#setSelected
85+
*/
86+
public void internalFrameDeactivated(InternalFrameEvent e);
87+
}

0 commit comments

Comments
 (0)