public class TextEvent extends AWTEvent
addTextListener方法注册接收此类事件的每个TextListener对象。
当事件发生时,实现TextListener接口的对象获得此TextEvent 。 监听器免除处理单个鼠标移动和关键笔划的细节,而不是像“文本改变”那样处理一个“有意义的”(语义)事件。
如果未指定的行为将引起id任何特定的参数TextEvent实例不在范围从TEXT_FIRST到TEXT_LAST 。
TextComponent , TextListener , Serialized Form
| Modifier and Type | Field and Description |
|---|---|
static int |
TEXT_FIRST
用于文本事件的ids范围中的第一个数字。
|
static int |
TEXT_LAST
用于文本事件的ids范围中的最后一个数字。
|
static int |
TEXT_VALUE_CHANGED
此事件id表示对象的文本已更改。
|
ACTION_EVENT_MASK, ADJUSTMENT_EVENT_MASK, COMPONENT_EVENT_MASK, consumed, CONTAINER_EVENT_MASK, FOCUS_EVENT_MASK, HIERARCHY_BOUNDS_EVENT_MASK, HIERARCHY_EVENT_MASK, id, INPUT_METHOD_EVENT_MASK, INVOCATION_EVENT_MASK, ITEM_EVENT_MASK, KEY_EVENT_MASK, MOUSE_EVENT_MASK, MOUSE_MOTION_EVENT_MASK, MOUSE_WHEEL_EVENT_MASK, PAINT_EVENT_MASK, RESERVED_ID_MAX, TEXT_EVENT_MASK, WINDOW_EVENT_MASK, WINDOW_FOCUS_EVENT_MASK, WINDOW_STATE_EVENT_MASKsource| Modifier and Type | Method and Description |
|---|---|
String |
paramString()
返回标识此文本事件的参数字符串。
|
getSourcepublic static final int TEXT_FIRST
public static final int TEXT_LAST
public static final int TEXT_VALUE_CHANGED
public TextEvent(Object source, int id)
TextEvent对象。
此方法抛出IllegalArgumentException如果source是null 。
source - 发起事件的(
TextComponent )对象
id - 标识事件类型的整数。
有关允许值的信息,请参阅TextEvent的类说明
IllegalArgumentException - 如果
source为空
EventObject.getSource() ,
AWTEvent.getID()
public String paramString()
paramString在类别
AWTEvent
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.