KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > util > EventObject


1 /*
2  * @(#)EventObject.java 1.20 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.util;
9
10 /**
11  * <p>
12  * The root class from which all event state objects shall be derived.
13  * <p>
14  * All Events are constructed with a reference to the object, the "source",
15  * that is logically deemed to be the object upon which the Event in question
16  * initially occurred upon.
17  *
18  * @since JDK1.1
19  */

20
21 public class EventObject implements java.io.Serializable JavaDoc {
22
23     private static final long serialVersionUID = 5516075349620653480L;
24
25     /**
26      * The object on which the Event initially occurred.
27      */

28     protected transient Object JavaDoc source;
29
30     /**
31      * Constructs a prototypical Event.
32      *
33      * @param source The object on which the Event initially occurred.
34      * @exception IllegalArgumentException if source is null.
35      */

36     public EventObject(Object JavaDoc source) {
37     if (source == null)
38         throw new IllegalArgumentException JavaDoc("null source");
39
40         this.source = source;
41     }
42
43     /**
44      * The object on which the Event initially occurred.
45      *
46      * @return The object on which the Event initially occurred.
47      */

48     public Object JavaDoc getSource() {
49         return source;
50     }
51
52     /**
53      * Returns a String representation of this EventObject.
54      *
55      * @return A a String representation of this EventObject.
56      */

57     public String JavaDoc toString() {
58         return getClass().getName() + "[source=" + source + "]";
59     }
60 }
61
Popular Tags