1. /*
  2. * @(#)TextEvent.java 1.11 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.awt.event;
  11. import java.awt.AWTEvent;
  12. import java.awt.Event;
  13. /**
  14. * A semantic event which indicates that an object's text changed.
  15. * This high-level event is generated by an object (such as a TextComponent)
  16. * when its text changes. The event is passed to
  17. * every <code>TextListener</code> object which registered to receive such
  18. * events using the component's <code>addTextListener</code> method.
  19. * <P>
  20. * The object that implements the <code>TextListener</code> interface gets
  21. * this <code>TextEvent</code> when the event occurs. The listener is
  22. * spared the details of processing individual mouse movements and key strokes
  23. * Instead, it can process a "meaningful" (semantic) event like "text changed".
  24. *
  25. * @author Georges Saab
  26. * @version 1.11 02/02/00
  27. *
  28. * @see java.awt.TextComponent
  29. * @see TextListener
  30. * @see <a href="http://java.sun.com/docs/books/tutorial/post1.0/ui/textlistener.html">Tutorial: Writing a Text Listener</a>
  31. * @see <a href="http://www.awl.com/cp/javaseries/jcl1_2.html">Reference: The Java Class Libraries (update file)</a>
  32. *
  33. * @since 1.1
  34. */
  35. public class TextEvent extends AWTEvent {
  36. /**
  37. * The first number in the range of ids used for text events.
  38. */
  39. public static final int TEXT_FIRST = 900;
  40. /**
  41. * The last number in the range of ids used for text events.
  42. */
  43. public static final int TEXT_LAST = 900;
  44. /**
  45. * This event id indicates that object's text changed.
  46. */
  47. public static final int TEXT_VALUE_CHANGED = TEXT_FIRST;
  48. /*
  49. * JDK 1.1 serialVersionUID
  50. */
  51. private static final long serialVersionUID = 6269902291250941179L;
  52. /**
  53. * Constructs a TextEvent object.
  54. *
  55. * @param source the (TextComponent) object that originated the event
  56. * @param id an integer that identifies the event type
  57. */
  58. public TextEvent(Object source, int id) {
  59. super(source, id);
  60. }
  61. /**
  62. * Returns a parameter string identifying this text event.
  63. * This method is useful for event-logging and for debugging.
  64. *
  65. * @return a string identifying the event and its attributes
  66. */
  67. public String paramString() {
  68. String typeStr;
  69. switch(id) {
  70. case TEXT_VALUE_CHANGED:
  71. typeStr = "TEXT_VALUE_CHANGED";
  72. break;
  73. default:
  74. typeStr = "unknown type";
  75. }
  76. return typeStr;
  77. }
  78. }