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

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