All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Class java.awt.event.InputMethodEvent

java.lang.Object
    |
    +----java.util.EventObject
            |
            +----java.awt.AWTEvent
                    |
                    +----java.awt.event.InputMethodEvent

public class InputMethodEvent
extends AWTEvent
Input method events contain information about text that is being composed using an input method. Whenever the text changes, the input method sends an event to the text editing component that uses it.

The text included with the input method event consists of two parts: committed text and composed text. Either part may be empty. The two parts together replace any uncommitted composed text sent in previous events, or the currently selected committed text. Committed text should be integrated into the text component's persistent data, it will not be sent again. Composed text may be sent repeatedly, with changes to reflect the user's editing operations. Committed text always precedes composed text.


Variable Index

 o ALL_CHARACTERS_COMMITTED
Constant indicating that the entire text sent with this event is committed.
 o CARET_POSITION_CHANGED
The event type indicating a changed insertion point in input method text.
 o INPUT_METHOD_FIRST
Marks the first integer id for the range of input method event ids.
 o INPUT_METHOD_LAST
Marks the last integer id for the range of input method event ids.
 o INPUT_METHOD_TEXT_CHANGED
The event type indicating changed input method text.

Constructor Index

 o InputMethodEvent(Component, int, AttributedCharacterIterator, int, TextHitInfo, TextHitInfo)
Constructs an InputMethodEvent with the specified source component, type, text, caret, and visiblePosition.
 o InputMethodEvent(Component, int, TextHitInfo, TextHitInfo)
Constructs an InputMethodEvent with the specified source component, type, caret, and visiblePosition.

Method Index

 o consume()
Consumes this event so that it will not be processed in the default manner by the source which originated it.
 o getCaret()
Gets the caret.
 o getCommittedCharacterCount()
Gets the number of committed characters in the text.
 o getText()
Gets the combined committed and composed text.
 o getVisiblePosition()
Gets the position that's most important to be visible.
 o isConsumed()
Returns whether or not this event has been consumed.

Variables

 o INPUT_METHOD_FIRST
public static final int INPUT_METHOD_FIRST
Marks the first integer id for the range of input method event ids.

 o INPUT_METHOD_TEXT_CHANGED
public static final int INPUT_METHOD_TEXT_CHANGED
The event type indicating changed input method text. This event is generated by input methods while processing input.

 o CARET_POSITION_CHANGED
public static final int CARET_POSITION_CHANGED
The event type indicating a changed insertion point in input method text. This event is generated by input methods while processing input if only the caret changed.

 o INPUT_METHOD_LAST
public static final int INPUT_METHOD_LAST
Marks the last integer id for the range of input method event ids.

 o ALL_CHARACTERS_COMMITTED
public static final int ALL_CHARACTERS_COMMITTED
Constant indicating that the entire text sent with this event is committed.

Constructors

 o InputMethodEvent
public InputMethodEvent(Component source,
                        int id,
                        AttributedCharacterIterator text,
                        int committedCharacterCount,
                        TextHitInfo caret,
                        TextHitInfo visiblePosition)
Constructs an InputMethodEvent with the specified source component, type, text, caret, and visiblePosition.

Parameters:
source - The object where the event originated.
id - The event type.
text - The combined committed and composed text, committed text first.
committedCharacterCount - The number of committed characters in the text, ALL_CHARACTERS_COMMITTED if all characters are committed.
caret - The caret (a.k.a. insertion point), with offset relative to text. Null if there's no caret.
visiblePosition - The position that's most important to be visible. Null if there's no recommendation.
 o InputMethodEvent
public InputMethodEvent(Component source,
                        int id,
                        TextHitInfo caret,
                        TextHitInfo visiblePosition)
Constructs an InputMethodEvent with the specified source component, type, caret, and visiblePosition.

Parameters:
source - The object where the event originated.
id - The event type.
caret - The caret (a.k.a. insertion point), with offset relative to text. Null if there's no caret.
visiblePosition - The position that's most important to be visible. Null if there's no recommendation.

Methods

 o getText
public AttributedCharacterIterator getText()
Gets the combined committed and composed text. If getCommittedCharacterCount returns ALL_CHARACTERS_COMMITTED, then the entire text is committed. Otherwise, Characters from offset 0 to offset getCommittedCharacterCount() are committed text, the remaining characters are composed text.

Returns:
the text
 o getCommittedCharacterCount
public int getCommittedCharacterCount()
Gets the number of committed characters in the text. If all characters are committed, ALL_CHARACTERS_COMMITTED is returned.

 o getCaret
public TextHitInfo getCaret()
Gets the caret. Null if there's no caret.

 o getVisiblePosition
public TextHitInfo getVisiblePosition()
Gets the position that's most important to be visible. Null if there's no recommendation.

 o consume
public void consume()
Consumes this event so that it will not be processed in the default manner by the source which originated it.

Overrides:
consume in class AWTEvent
 o isConsumed
public boolean isConsumed()
Returns whether or not this event has been consumed.

Overrides:
isConsumed in class AWTEvent
See Also:
consume

All Packages  Class Hierarchy  This Package  Previous  Next  Index  

Submit a bug or feature