public class InputMethodEvent extends java.awt.AWTEvent
InputMethodListener,
Serialized Form| Modifier 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| Constructor and Description |
|---|
InputMethodEvent(java.awt.Component source,
int id,
java.text.AttributedCharacterIterator text,
int committedCharacterCount,
java.awt.font.TextHitInfo caret,
java.awt.font.TextHitInfo visiblePosition)
Initializes a new instance of
InputMethodEvent with the
specified source, id, text, char count, caret, and visible position. |
InputMethodEvent(java.awt.Component source,
int id,
long when,
java.text.AttributedCharacterIterator text,
int committedCharacterCount,
java.awt.font.TextHitInfo caret,
java.awt.font.TextHitInfo visiblePosition)
Initializes a new instance of
InputMethodEvent with the
specified source, id, timestamp, text, char count, caret, and visible
position. |
InputMethodEvent(java.awt.Component source,
int id,
java.awt.font.TextHitInfo caret,
java.awt.font.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.
|
java.awt.font.TextHitInfo |
getCaret()
Returns the caret position.
|
int |
getCommittedCharacterCount()
Returns the number of committed characters in the input method text.
|
java.text.AttributedCharacterIterator |
getText()
This method returns the input method text.
|
java.awt.font.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.
|
java.lang.String |
paramString()
This method returns a string identifying the event.
|
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(java.awt.Component source, int id, long when, java.text.AttributedCharacterIterator text, int committedCharacterCount, java.awt.font.TextHitInfo caret, java.awt.font.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 visiblejava.lang.IllegalArgumentException - 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(java.awt.Component source, int id, java.text.AttributedCharacterIterator text, int committedCharacterCount, java.awt.font.TextHitInfo caret, java.awt.font.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 visiblejava.lang.IllegalArgumentException - 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(java.awt.Component source, int id, java.awt.font.TextHitInfo caret, java.awt.font.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 visiblejava.lang.IllegalArgumentException - if source is null or id is invalidpublic java.text.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 java.awt.font.TextHitInfo getCaret()
INPUT_METHOD_TEXT_CHANGED event.public java.awt.font.TextHitInfo getVisiblePosition()
INPUT_METHOD_TEXT_CHANGED event.public void consume()
consume in class java.awt.AWTEventpublic boolean isConsumed()
isConsumed in class java.awt.AWTEventpublic long getWhen()
public java.lang.String paramString()
paramString in class java.awt.AWTEvent