home *** CD-ROM | disk | FTP | other *** search
/ Java 1.2 How-To / JavaHowTo.iso / 3rdParty / jbuilder / unsupported / JDK1.2beta3 / SOURCE / SRC.ZIP / java / util / EventObject.java < prev    next >
Encoding:
Java Source  |  1998-03-20  |  1.4 KB  |  54 lines

  1. /*
  2.  * @(#)EventObject.java    1.8 98/03/18
  3.  *
  4.  * Copyright 1996, 1997 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.util;
  16.  
  17. /**
  18.  * <p>
  19.  * The Event class is the abstract root class from which all event state
  20.  * objects shall be derived.
  21.  * <p>
  22.  * All Event's are constructed with a reference to the object, the "source",
  23.  * that is logically deemed to be the object upon which the Event in question
  24.  * initially occurred upon.
  25.  */
  26.  
  27. public class EventObject implements java.io.Serializable {
  28.     protected transient Object  source;
  29.  
  30.     /**
  31.      * Constructs a prototypical Event 
  32.      *
  33.      * @param    source    The object that the Event occurred upon.
  34.      */
  35.     public EventObject(Object source) {
  36.     if (source == null)
  37.         throw new IllegalArgumentException("null source");
  38.  
  39.         this.source = source;
  40.     }
  41.  
  42.     /**
  43.      * @return  The object that the Event initially occurred upon.
  44.      */
  45.  
  46.     public Object getSource() {
  47.         return source;
  48.     }
  49.  
  50.     public String toString() {
  51.         return getClass().getName() + "[source=" + source + "]";
  52.     }
  53. }
  54.