public final class InputMethodEvent extends InputEvent
Node
.
This event is delivered to the Node
object that extends
TextInputControl
, when the text under composition
(composed text) is generated/changed/removed, the input method commits
the result text, or the input method caret position changes.
On receiving this event, the application is supposed to display the composed text with any visual feedback attributes to the user.
Note: this is a conditional feature. See
ConditionalFeature.INPUT_METHOD
for more information.
Modifier and Type | Field and Description |
---|---|
static EventType<InputMethodEvent> |
ANY
Common supertype for all input method event types.
|
static EventType<InputMethodEvent> |
INPUT_METHOD_TEXT_CHANGED
The only valid EventType for the InputMethodEvent.
|
consumed, eventType, NULL_SOURCE_TARGET, target
source
Constructor and Description |
---|
InputMethodEvent(EventType<InputMethodEvent> eventType,
List<InputMethodTextRun> composed,
String committed,
int caretPosition)
Constructs new InputMethodEvent event with empty source and target.
|
InputMethodEvent(Object source,
EventTarget target,
EventType<InputMethodEvent> eventType,
List<InputMethodTextRun> composed,
String committed,
int caretPosition)
Constructs new InputMethodEvent event.
|
Modifier and Type | Method and Description |
---|---|
InputMethodEvent |
copyFor(Object newSource,
EventTarget newTarget)
Creates and returns a copy of this event with the specified event source
and target.
|
int |
getCaretPosition()
The input method caret position within the composed text.
|
String |
getCommitted()
Gets the text that is committed by the input method as the result of the
composition.
|
ObservableList<InputMethodTextRun> |
getComposed()
Gets the text under composition.
|
EventType<InputMethodEvent> |
getEventType()
Gets the event type of this event.
|
String |
toString()
Returns a string representation of this
InputMethodEvent object. |
getSource
public static final EventType<InputMethodEvent> INPUT_METHOD_TEXT_CHANGED
public static final EventType<InputMethodEvent> ANY
public InputMethodEvent(Object source, EventTarget target, EventType<InputMethodEvent> eventType, List<InputMethodTextRun> composed, String committed, int caretPosition)
source
- the source of the event. Can be null.target
- the target of the event. Can be null.eventType
- The type of the event.composed
- the text under compositioncommitted
- the text that is committed as a result of compositioncaretPosition
- the current position of the caret.public InputMethodEvent(EventType<InputMethodEvent> eventType, List<InputMethodTextRun> composed, String committed, int caretPosition)
eventType
- The type of the event.composed
- the text under compositioncommitted
- the text that is committed as a result of compositioncaretPosition
- the current position of the caret.public final ObservableList<InputMethodTextRun> getComposed()
InputMethodHighlight
s
attached to each run.public final String getCommitted()
public final int getCaretPosition()
public String toString()
InputMethodEvent
object.toString
in class EventObject
InputMethodEvent
object.public InputMethodEvent copyFor(Object newSource, EventTarget newTarget)
Event
null
, it is
replaced by the NULL_SOURCE_TARGET
value.public EventType<InputMethodEvent> getEventType()
Event
Event
class can have different event types. These event types further specify
what kind of event occurred.getEventType
in class InputEvent
Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.