1. /*
  2. * @(#)EventObject.java 1.15 00/02/02
  3. *
  4. * Copyright 1996-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package java.util;
  11. /**
  12. * <p>
  13. * The root class from which all event state objects shall be derived.
  14. * <p>
  15. * All Events are constructed with a reference to the object, the "source",
  16. * that is logically deemed to be the object upon which the Event in question
  17. * initially occurred upon.
  18. *
  19. * @since JDK1.1
  20. */
  21. public class EventObject implements java.io.Serializable {
  22. /**
  23. * The object on which the Event initially occurred.
  24. */
  25. protected transient Object source;
  26. /**
  27. * Constructs a prototypical Event.
  28. *
  29. * @param source The object on which the Event initially occurred.
  30. */
  31. public EventObject(Object source) {
  32. if (source == null)
  33. throw new IllegalArgumentException("null source");
  34. this.source = source;
  35. }
  36. /**
  37. * The object on which the Event initially occurred.
  38. *
  39. * @return The object on which the Event initially occurred.
  40. */
  41. public Object getSource() {
  42. return source;
  43. }
  44. /**
  45. * Returns a String representation of this EventObject.
  46. *
  47. * @return A a String representation of this EventObject.
  48. */
  49. public String toString() {
  50. return getClass().getName() + "[source=" + source + "]";
  51. }
  52. }