public class InputMethodEvent extends AWTEvent
InputMethodListener
,
Serialized FormModifier and Type | Field and Description |
---|---|
static int |
CARET_POSITION_CHANGED
This event id indicates that the input method curor point has changed.
|
static int |
INPUT_METHOD_FIRST
This is the first id in the range of event ids used by this class.
|
static int |
INPUT_METHOD_LAST
This is the last id in the range of event ids used by this class.
|
static int |
INPUT_METHOD_TEXT_CHANGED
This event id indicates that the text in the input method has changed.
|
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_MASK
source
Constructor and Description |
---|
InputMethodEvent(Component source,
int id,
AttributedCharacterIterator text,
int committedCharacterCount,
TextHitInfo caret,
TextHitInfo visiblePosition)
Initializes a new instance of
InputMethodEvent with the
specified source, id, text, char count, caret, and visible position. |
InputMethodEvent(Component source,
int id,
long when,
AttributedCharacterIterator text,
int committedCharacterCount,
TextHitInfo caret,
TextHitInfo visiblePosition)
Initializes a new instance of
InputMethodEvent with the
specified source, id, timestamp, text, char count, caret, and visible
position. |
InputMethodEvent(Component source,
int id,
TextHitInfo caret,
TextHitInfo visiblePosition)
Initializes a new instance of
InputMethodEvent with the
specified source, id, caret, and visible position, and with a null
text and char count. |
Modifier and Type | Method and Description |
---|---|
void |
consume()
This method consumes the event.
|
TextHitInfo |
getCaret()
Returns the caret position.
|
int |
getCommittedCharacterCount()
Returns the number of committed characters in the input method text.
|
AttributedCharacterIterator |
getText()
This method returns the input method text.
|
TextHitInfo |
getVisiblePosition()
Returns the position that is most important to be visible, or null if
such a hint is not necessary.
|
long |
getWhen()
Return the timestamp of this event.
|
boolean |
isConsumed()
This method tests whether or not this event has been consumed.
|
String |
paramString()
This method returns a string identifying the event.
|
getSource
public static final int INPUT_METHOD_FIRST
public static final int INPUT_METHOD_TEXT_CHANGED
public static final int CARET_POSITION_CHANGED
public static final int INPUT_METHOD_LAST
public InputMethodEvent(Component source, int id, long when, AttributedCharacterIterator text, int committedCharacterCount, TextHitInfo caret, TextHitInfo visiblePosition)
InputMethodEvent
with the
specified source, id, timestamp, text, char count, caret, and visible
position.source
- the source that generated the eventid
- the event idwhen
- the timestamp of the eventtext
- the input textcommittedCharacterCount
- the number of committed characterscaret
- the caret positionvisiblePosition
- the position most important to make visibleIllegalArgumentException
- if source is null, id is invalid, id is
CARET_POSITION_CHANGED and text is non-null, or if
committedCharacterCount is out of rangepublic InputMethodEvent(Component source, int id, AttributedCharacterIterator text, int committedCharacterCount, TextHitInfo caret, TextHitInfo visiblePosition)
InputMethodEvent
with the
specified source, id, text, char count, caret, and visible position.source
- the source that generated the eventid
- the event idtext
- the input textcommittedCharacterCount
- the number of committed characterscaret
- the caret positionvisiblePosition
- the position most important to make visibleIllegalArgumentException
- if source is null, id is invalid, id is
CARET_POSITION_CHANGED and text is non-null, or if
committedCharacterCount is out of rangepublic InputMethodEvent(Component source, int id, TextHitInfo caret, TextHitInfo visiblePosition)
InputMethodEvent
with the
specified source, id, caret, and visible position, and with a null
text and char count.source
- the source that generated the eventid
- the event idcaret
- the caret positionvisiblePosition
- the position most important to make visibleIllegalArgumentException
- if source is null or id is invalidpublic AttributedCharacterIterator getText()
null
,
and will always be null for CARET_POSITION_CHANGED
events.
Characters from 0 to getCommittedCharacterCount()-1
have
been committed, the remaining characters are composed text.public int getCommittedCharacterCount()
public TextHitInfo getCaret()
INPUT_METHOD_TEXT_CHANGED
event.public TextHitInfo getVisiblePosition()
INPUT_METHOD_TEXT_CHANGED
event.public void consume()
public boolean isConsumed()
isConsumed
in class AWTEvent
public long getWhen()
public String paramString()
paramString
in class AWTEvent