jaroslav@597: /* jaroslav@597: * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved. jaroslav@597: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jaroslav@597: * jaroslav@597: * This code is free software; you can redistribute it and/or modify it jaroslav@597: * under the terms of the GNU General Public License version 2 only, as jaroslav@597: * published by the Free Software Foundation. Oracle designates this jaroslav@597: * particular file as subject to the "Classpath" exception as provided jaroslav@597: * by Oracle in the LICENSE file that accompanied this code. jaroslav@597: * jaroslav@597: * This code is distributed in the hope that it will be useful, but WITHOUT jaroslav@597: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jaroslav@597: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jaroslav@597: * version 2 for more details (a copy is included in the LICENSE file that jaroslav@597: * accompanied this code). jaroslav@597: * jaroslav@597: * You should have received a copy of the GNU General Public License version jaroslav@597: * 2 along with this work; if not, write to the Free Software Foundation, jaroslav@597: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jaroslav@597: * jaroslav@597: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA jaroslav@597: * or visit www.oracle.com if you need additional information or have any jaroslav@597: * questions. jaroslav@597: */ jaroslav@597: jaroslav@597: package java.util; jaroslav@597: jaroslav@597: /** jaroslav@597: *

jaroslav@597: * The root class from which all event state objects shall be derived. jaroslav@597: *

jaroslav@597: * All Events are constructed with a reference to the object, the "source", jaroslav@597: * that is logically deemed to be the object upon which the Event in question jaroslav@597: * initially occurred upon. jaroslav@597: * jaroslav@597: * @since JDK1.1 jaroslav@597: */ jaroslav@597: jaroslav@597: public class EventObject implements java.io.Serializable { jaroslav@597: jaroslav@597: private static final long serialVersionUID = 5516075349620653480L; jaroslav@597: jaroslav@597: /** jaroslav@597: * The object on which the Event initially occurred. jaroslav@597: */ jaroslav@597: protected transient Object source; jaroslav@597: jaroslav@597: /** jaroslav@597: * Constructs a prototypical Event. jaroslav@597: * jaroslav@597: * @param source The object on which the Event initially occurred. jaroslav@597: * @exception IllegalArgumentException if source is null. jaroslav@597: */ jaroslav@597: public EventObject(Object source) { jaroslav@597: if (source == null) jaroslav@597: throw new IllegalArgumentException("null source"); jaroslav@597: jaroslav@597: this.source = source; jaroslav@597: } jaroslav@597: jaroslav@597: /** jaroslav@597: * The object on which the Event initially occurred. jaroslav@597: * jaroslav@597: * @return The object on which the Event initially occurred. jaroslav@597: */ jaroslav@597: public Object getSource() { jaroslav@597: return source; jaroslav@597: } jaroslav@597: jaroslav@597: /** jaroslav@597: * Returns a String representation of this EventObject. jaroslav@597: * jaroslav@597: * @return A a String representation of this EventObject. jaroslav@597: */ jaroslav@597: public String toString() { jaroslav@597: return getClass().getName() + "[source=" + source + "]"; jaroslav@597: } jaroslav@597: }