Top Description Fields Constructors Methods
javafx.scene.input

public final Class InputMethodEvent

extends InputEvent
Class Inheritance
Imports
java.io.IOException, .ObjectInputStream, .ObjectOutputStream, java.util.ArrayList, .List, javafx.beans.NamedArg, javafx.collections.FXCollections, .ObservableList, javafx.event.EventTarget, .EventType, javafx.scene.Node

An event which indicates that the underlying input method notifies its text change in a Node.

This event is delivered to the Node object that extends javafx.scene.control.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.

Since
JavaFX 2.0

Field Summary

Modifier and TypeField and Description
public static final EventType<InputMethodEvent>
ANY

Hides javafx.scene.input.InputEvent.ANY.

Common supertype for all input method event types.
private final int
caretPosition

The input method caret position within the composed text.

private final String
committed

The text that is committed by the input method as the result of the composition.

private transient ObservableList<InputMethodTextRun>
composed

The text under composition.

public static final EventType<InputMethodEvent>
INPUT_METHOD_TEXT_CHANGED

The only valid EventType for the InputMethodEvent.

private static final long

Constructor Summary

AccessConstructor and Description
public
InputMethodEvent(Object
the source of the event. Can be null.
source
,
EventTarget
the target of the event. Can be null.
target
,
EventType<InputMethodEvent>
The type of the event.
eventType
,
List<InputMethodTextRun>
the text under composition
composed
,
String
the text that is committed as a result of composition
committed
,
int
the current position of the caret.
caretPosition
)

Constructs new InputMethodEvent event.

public
InputMethodEvent(EventType<InputMethodEvent>
The type of the event.
eventType
,
List<InputMethodTextRun>
the text under composition
composed
,
String
the text that is committed as a result of composition
committed
,
int
the current position of the caret.
caretPosition
)

Constructs new InputMethodEvent event with empty source and target.

Method Summary

Modifier and TypeMethod and Description
public InputMethodEvent
copyFor(Object newSource, EventTarget newTarget)

Overrides javafx.event.Event.copyFor.

Creates and returns a copy of this event with the specified event source and target.

public final int

Returns:

The input method caret position within the composed text
getCaretPosition
()

The input method caret position within the composed text.

public final String

Returns:

The committed text
getCommitted
()

Gets the text that is committed by the input method as the result of the composition.

public final ObservableList<InputMethodTextRun>

Returns:

The text under composition
getComposed
()

Gets the text under composition.

public EventType<InputMethodEvent>
getEventType()

Overrides javafx.scene.input.InputEvent.getEventType.

Gets the event type of this event.

private void
public String

Returns:

a string representation of this InputMethodEvent object.
toString
()

Overrides java.util.EventObject.toString.

Returns a string representation of this InputMethodEvent object.

private void

Field Detail

ANYback to summary
public static final EventType<InputMethodEvent> ANY

Hides javafx.scene.input.InputEvent.ANY.

Common supertype for all input method event types.

Since
JavaFX 8.0
caretPositionback to summary
private final int caretPosition

The input method caret position within the composed text. If the position is -1, the caret should be invisible.

Default Value
0
committedback to summary
private final String committed

The text that is committed by the input method as the result of the composition.

Default Value
empty string
composedback to summary
private transient ObservableList<InputMethodTextRun> composed

The text under composition. This text should be displayed with the appropriate visual feedback that represents the InputMethodHighlights attached to each run.

Default Value
null
INPUT_METHOD_TEXT_CHANGEDback to summary
public static final EventType<InputMethodEvent> INPUT_METHOD_TEXT_CHANGED

The only valid EventType for the InputMethodEvent.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides javafx.scene.input.InputEvent.serialVersionUID.

Constructor Detail

InputMethodEventback to summary
public InputMethodEvent(Object source, EventTarget target, EventType<InputMethodEvent> eventType, List<InputMethodTextRun> composed, String committed, int caretPosition)

Constructs new InputMethodEvent event.

Parameters
source:Object

the source of the event. Can be null.

target:EventTarget

the target of the event. Can be null.

eventType:EventType<InputMethodEvent>

The type of the event.

composed:List<InputMethodTextRun>

the text under composition

committed:String

the text that is committed as a result of composition

caretPosition:int

the current position of the caret.

Since
JavaFX 8.0
InputMethodEventback to summary
public InputMethodEvent(EventType<InputMethodEvent> eventType, List<InputMethodTextRun> composed, String committed, int caretPosition)

Constructs new InputMethodEvent event with empty source and target.

Parameters
eventType:EventType<InputMethodEvent>

The type of the event.

composed:List<InputMethodTextRun>

the text under composition

committed:String

the text that is committed as a result of composition

caretPosition:int

the current position of the caret.

Since
JavaFX 8.0

Method Detail

copyForback to summary
public InputMethodEvent copyFor(Object newSource, EventTarget newTarget)

Overrides javafx.event.Event.copyFor.

Doc from javafx.event.Event.copyFor.

Creates and returns a copy of this event with the specified event source and target. If the source or target is set to null, it is replaced by the NULL_SOURCE_TARGET value.

Annotations
@Override
getCaretPositionback to summary
public final int getCaretPosition()

The input method caret position within the composed text. If the position is -1, the caret should be invisible.

Returns:int

The input method caret position within the composed text

getCommittedback to summary
public final String getCommitted()

Gets the text that is committed by the input method as the result of the composition.

Returns:String

The committed text

getComposedback to summary
public final ObservableList<InputMethodTextRun> getComposed()

Gets the text under composition. This text should be displayed with the appropriate visual feedback that represents the InputMethodHighlights attached to each run.

Returns:ObservableList<InputMethodTextRun>

The text under composition

getEventTypeback to summary
public EventType<InputMethodEvent> getEventType()

Overrides javafx.scene.input.InputEvent.getEventType.

Doc from javafx.event.Event.getEventType.

Gets the event type of this event. Objects of the same Event class can have different event types. These event types further specify what kind of event occurred.

Annotations
@Override
readObjectback to summary
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException

Hides javafx.event.Event.readObject.

Annotations
@SuppressWarnings:doclint:missing
toStringback to summary
public String toString()

Overrides java.util.EventObject.toString.

Returns a string representation of this InputMethodEvent object.

Returns:String

a string representation of this InputMethodEvent object.

Annotations
@Override
writeObjectback to summary
private void writeObject(ObjectOutputStream oos) throws IOException
Annotations
@SuppressWarnings:doclint:missing