Example usage for java.awt.event InputMethodEvent INPUT_METHOD_TEXT_CHANGED

List of usage examples for java.awt.event InputMethodEvent INPUT_METHOD_TEXT_CHANGED

Introduction

In this page you can find the example usage for java.awt.event InputMethodEvent INPUT_METHOD_TEXT_CHANGED.

Prototype

int INPUT_METHOD_TEXT_CHANGED

To view the source code for java.awt.event InputMethodEvent INPUT_METHOD_TEXT_CHANGED.

Click Source Link

Document

The event type indicating changed input method text.

Usage

From source file:SimpleInputMethod.java

private void write(char ch) {
    AttributedString as = new AttributedString(String.valueOf(ch));
    inputMethodContext.dispatchInputMethodEvent(InputMethodEvent.INPUT_METHOD_TEXT_CHANGED, as.getIterator(), 1,
            null, null);/*from  www  . ja va  2  s . c  om*/
}

From source file:CodePointInputMethod.java

/**
 * Send the composed text to the client.
 *///from   w ww  . j a  v a 2s .  com
private void sendComposedText() {
    AttributedString as = new AttributedString(buffer.toString());
    as.addAttribute(TextAttribute.INPUT_METHOD_HIGHLIGHT, InputMethodHighlight.SELECTED_RAW_TEXT_HIGHLIGHT);
    context.dispatchInputMethodEvent(InputMethodEvent.INPUT_METHOD_TEXT_CHANGED, as.getIterator(), 0,
            TextHitInfo.leading(insertionPoint), null);
}

From source file:CodePointInputMethod.java

/**
 * Send the committed text to the client.
 */// w w  w. j av  a2s. c  o  m
private void sendCommittedText() {
    AttributedString as = new AttributedString(buffer.toString());
    context.dispatchInputMethodEvent(InputMethodEvent.INPUT_METHOD_TEXT_CHANGED, as.getIterator(),
            buffer.length(), TextHitInfo.leading(insertionPoint), null);

    buffer.setLength(0);
    insertionPoint = 0;
    format = UNSET;
}