FileDocCategorySizeDatePackage
TextEvent.javaAPI DocJava SE 5 API2949Fri Aug 26 14:56:50 BST 2005java.awt.event

TextEvent

public class TextEvent extends AWTEvent
A semantic event which indicates that an object's text changed. This high-level event is generated by an object (such as a TextComponent) when its text changes. The event is passed to every TextListener object which registered to receive such events using the component's addTextListener method.

The object that implements the TextListener interface gets this TextEvent when the event occurs. The listener is spared the details of processing individual mouse movements and key strokes Instead, it can process a "meaningful" (semantic) event like "text changed".

author
Georges Saab
version
1.16 12/19/03
see
java.awt.TextComponent
see
TextListener
see
Tutorial: Writing a Text Listener
see
Reference: The Java Class Libraries (update file)
since
1.1

Fields Summary
public static final int
TEXT_FIRST
The first number in the range of ids used for text events.
public static final int
TEXT_LAST
The last number in the range of ids used for text events.
public static final int
TEXT_VALUE_CHANGED
This event id indicates that object's text changed.
private static final long
serialVersionUID
Constructors Summary
public TextEvent(Object source, int id)
Constructs a TextEvent object.

Note that passing in an invalid id results in unspecified behavior. This method throws an IllegalArgumentException if source is null.

param
source the (TextComponent) object that originated the event
param
id an integer that identifies the event type
throws
IllegalArgumentException if source is null


                                                                           
         
        super(source, id);
    
Methods Summary
public java.lang.StringparamString()
Returns a parameter string identifying this text event. This method is useful for event-logging and for debugging.

return
a string identifying the event and its attributes

        String typeStr;
        switch(id) {
          case TEXT_VALUE_CHANGED:
              typeStr = "TEXT_VALUE_CHANGED";
              break;
          default:
              typeStr = "unknown type";
        }
        return typeStr;