001 /* InternalFrameEvent.java --
002 Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
003
004 This file is part of GNU Classpath.
005
006 GNU Classpath is free software; you can redistribute it and/or modify
007 it under the terms of the GNU General Public License as published by
008 the Free Software Foundation; either version 2, or (at your option)
009 any later version.
010
011 GNU Classpath is distributed in the hope that it will be useful, but
012 WITHOUT ANY WARRANTY; without even the implied warranty of
013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014 General Public License for more details.
015
016 You should have received a copy of the GNU General Public License
017 along with GNU Classpath; see the file COPYING. If not, write to the
018 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
019 02110-1301 USA.
020
021 Linking this library statically or dynamically with other modules is
022 making a combined work based on this library. Thus, the terms and
023 conditions of the GNU General Public License cover the whole
024 combination.
025
026 As a special exception, the copyright holders of this library give you
027 permission to link this library with independent modules to produce an
028 executable, regardless of the license terms of these independent
029 modules, and to copy and distribute the resulting executable under
030 terms of your choice, provided that you also meet, for each linked
031 independent module, the terms and conditions of the license of that
032 module. An independent module is a module which is not derived from
033 or based on this library. If you modify this library, you may extend
034 this exception to your version of the library, but you are not
035 obligated to do so. If you do not wish to do so, delete this
036 exception statement from your version. */
037
038
039 package javax.swing.event;
040
041 import java.awt.AWTEvent;
042
043 import javax.swing.JInternalFrame;
044
045 /**
046 * An event that indicates a change to a {@link JInternalFrame} component.
047 *
048 * @author Andrew Selkirk
049 */
050 public class InternalFrameEvent extends AWTEvent
051 {
052 private static final long serialVersionUID = -5204823611874873183L;
053
054 /**
055 * Internal frame activated event.
056 */
057 public static final int INTERNAL_FRAME_ACTIVATED = 25554;
058
059 /**
060 * Internal frame closed event.
061 */
062 public static final int INTERNAL_FRAME_CLOSED = 25551;
063
064 /**
065 * Internal frame closing event.
066 */
067 public static final int INTERNAL_FRAME_CLOSING = 25550;
068
069 /**
070 * Internal frame deactivated event.
071 */
072 public static final int INTERNAL_FRAME_DEACTIVATED = 25555;
073
074 /**
075 * Internal frame deiconifed event.
076 */
077 public static final int INTERNAL_FRAME_DEICONIFIED = 25553;
078
079 /**
080 * Internal frame frame first event.
081 */
082 public static final int INTERNAL_FRAME_FIRST = 25549;
083
084 /**
085 * Internal frame iconified event.
086 */
087 public static final int INTERNAL_FRAME_ICONIFIED = 25552;
088
089 /**
090 * Internal frame last event.
091 */
092 public static final int INTERNAL_FRAME_LAST = 25555;
093
094 /**
095 * Internal frame opened event.
096 */
097 public static final int INTERNAL_FRAME_OPENED = 25549;
098
099 /**
100 * Creates a new <code>JInternalFrameEvent</code> instance.
101 *
102 * @param source the source of this event (<code>null</code> not permitted).
103 * @param id the event ID of this event (see the constants defined by this
104 * class).
105 *
106 * @throws IllegalArgumentException if <code>source</code> is
107 * <code>null</code>.
108 */
109 public InternalFrameEvent(JInternalFrame source, int id)
110 {
111 super(source, id);
112 }
113
114 /**
115 * Returns the <code>JInternalFrame</code> component that is the source for
116 * this event.
117 *
118 * @return The source.
119 *
120 * @since 1.3
121 */
122 public JInternalFrame getInternalFrame()
123 {
124 return (JInternalFrame) source;
125 }
126
127 /**
128 * Returns a string that indicates the event id. This is used by the
129 * {@link #toString()} method.
130 *
131 * @return A string that indicates the event id.
132 */
133 public String paramString()
134 {
135 switch (id) {
136 case INTERNAL_FRAME_ACTIVATED:
137 return "INTERNAL_FRAME_ACTIVATED";
138 case INTERNAL_FRAME_CLOSED:
139 return "INTERNAL_FRAME_CLOSED";
140 case INTERNAL_FRAME_CLOSING:
141 return "INTERNAL_FRAME_CLOSING";
142 case INTERNAL_FRAME_DEACTIVATED:
143 return "INTERNAL_FRAME_DEACTIVATED";
144 case INTERNAL_FRAME_DEICONIFIED:
145 return "INTERNAL_FRAME_DEICONIFIED";
146 case INTERNAL_FRAME_ICONIFIED:
147 return "INTERNAL_FRAME_ICONIFIED";
148 case INTERNAL_FRAME_OPENED:
149 return "INTERNAL_FRAME_OPENED";
150 default:
151 return "unknown type";
152 }
153 }
154 }