Java Code Examples for java.awt.event.InputMethodEvent#INPUT_METHOD_TEXT_CHANGED

The following examples show how to use java.awt.event.InputMethodEvent#INPUT_METHOD_TEXT_CHANGED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CompositionAreaHandler.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
void processInputMethodEvent(InputMethodEvent event) {
    if (event.getID() == InputMethodEvent.INPUT_METHOD_TEXT_CHANGED) {
        inputMethodTextChanged(event);
    } else {
        caretPositionChanged(event);
    }
}
 
Example 2
Source File: CompositionAreaHandler.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
void processInputMethodEvent(InputMethodEvent event) {
    if (event.getID() == InputMethodEvent.INPUT_METHOD_TEXT_CHANGED) {
        inputMethodTextChanged(event);
    } else {
        caretPositionChanged(event);
    }
}
 
Example 3
Source File: CompositionAreaHandler.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
void processInputMethodEvent(InputMethodEvent event) {
    if (event.getID() == InputMethodEvent.INPUT_METHOD_TEXT_CHANGED) {
        inputMethodTextChanged(event);
    } else {
        caretPositionChanged(event);
    }
}
 
Example 4
Source File: CompositionAreaHandler.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
void processInputMethodEvent(InputMethodEvent event) {
    if (event.getID() == InputMethodEvent.INPUT_METHOD_TEXT_CHANGED) {
        inputMethodTextChanged(event);
    } else {
        caretPositionChanged(event);
    }
}
 
Example 5
Source File: CompositionAreaHandler.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
void processInputMethodEvent(InputMethodEvent event) {
    if (event.getID() == InputMethodEvent.INPUT_METHOD_TEXT_CHANGED) {
        inputMethodTextChanged(event);
    } else {
        caretPositionChanged(event);
    }
}
 
Example 6
Source File: bug6636983.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
void sendInputMethodEvent() {
    InputMethodEvent ime = new InputMethodEvent(
            ep,
            InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
            Hiragana_A.getIterator(),
            0,
            null,
            null);
    ep.dispatchEvent(ime);
}
 
Example 7
Source File: bug6636983.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
void sendInputMethodEvent() {
    InputMethodEvent ime = new InputMethodEvent(
            ep,
            InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
            Hiragana_A.getIterator(),
            0,
            null,
            null);
    ep.dispatchEvent(ime);
}
 
Example 8
Source File: CompositionAreaHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
void processInputMethodEvent(InputMethodEvent event) {
    if (event.getID() == InputMethodEvent.INPUT_METHOD_TEXT_CHANGED) {
        inputMethodTextChanged(event);
    } else {
        caretPositionChanged(event);
    }
}
 
Example 9
Source File: CompositionAreaHandler.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
void processInputMethodEvent(InputMethodEvent event) {
    if (event.getID() == InputMethodEvent.INPUT_METHOD_TEXT_CHANGED) {
        inputMethodTextChanged(event);
    } else {
        caretPositionChanged(event);
    }
}
 
Example 10
Source File: CompositionAreaHandler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
void processInputMethodEvent(InputMethodEvent event) {
    if (event.getID() == InputMethodEvent.INPUT_METHOD_TEXT_CHANGED) {
        inputMethodTextChanged(event);
    } else {
        caretPositionChanged(event);
    }
}
 
Example 11
Source File: CompositionAreaHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
void processInputMethodEvent(InputMethodEvent event) {
    if (event.getID() == InputMethodEvent.INPUT_METHOD_TEXT_CHANGED) {
        inputMethodTextChanged(event);
    } else {
        caretPositionChanged(event);
    }
}
 
Example 12
Source File: CompositionAreaHandler.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
void processInputMethodEvent(InputMethodEvent event) {
    if (event.getID() == InputMethodEvent.INPUT_METHOD_TEXT_CHANGED) {
        inputMethodTextChanged(event);
    } else {
        caretPositionChanged(event);
    }
}
 
Example 13
Source File: bug6636983.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
void sendInputMethodEvent() {
    InputMethodEvent ime = new InputMethodEvent(
            ep,
            InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
            Hiragana_A.getIterator(),
            0,
            null,
            null);
    ep.dispatchEvent(ime);
}
 
Example 14
Source File: InputMethodContext.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Dispatches committed text to a client component.
 * Called by composition window.
 *
 * @param client The component that the text should get dispatched to.
 * @param text The iterator providing access to the committed
 *        (and possible composed) text.
 * @param committedCharacterCount The number of committed characters in the text.
 */
synchronized void dispatchCommittedText(Component client,
             AttributedCharacterIterator text,
             int committedCharacterCount) {
    // note that the client is not always the current client component -
    // some host input method adapters may dispatch input method events
    // through the Java event queue, and we may have switched clients while
    // the event was in the queue.
    if (committedCharacterCount == 0
            || text.getEndIndex() <= text.getBeginIndex()) {
        return;
    }
    long time = System.currentTimeMillis();
    dispatchingCommittedText = true;
    try {
        InputMethodRequests req = client.getInputMethodRequests();
        if (req != null) {
            // active client -> send text as InputMethodEvent
            int beginIndex = text.getBeginIndex();
            AttributedCharacterIterator toBeCommitted =
                (new AttributedString(text, beginIndex, beginIndex + committedCharacterCount)).getIterator();

            InputMethodEvent inputEvent = new InputMethodEvent(
                    client,
                    InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
                    toBeCommitted,
                    committedCharacterCount,
                    null, null);

            client.dispatchEvent(inputEvent);
        } else {
            // passive client -> send text as KeyEvents
            char keyChar = text.first();
            while (committedCharacterCount-- > 0 && keyChar != CharacterIterator.DONE) {
                KeyEvent keyEvent = new KeyEvent(client, KeyEvent.KEY_TYPED,
                                             time, 0, KeyEvent.VK_UNDEFINED, keyChar);
                client.dispatchEvent(keyEvent);
                keyChar = text.next();
            }
        }
    } finally {
        dispatchingCommittedText = false;
    }
}
 
Example 15
Source File: InputMethodContext.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Dispatches committed text to a client component.
 * Called by composition window.
 *
 * @param client The component that the text should get dispatched to.
 * @param text The iterator providing access to the committed
 *        (and possible composed) text.
 * @param committedCharacterCount The number of committed characters in the text.
 */
synchronized void dispatchCommittedText(Component client,
             AttributedCharacterIterator text,
             int committedCharacterCount) {
    // note that the client is not always the current client component -
    // some host input method adapters may dispatch input method events
    // through the Java event queue, and we may have switched clients while
    // the event was in the queue.
    if (committedCharacterCount == 0
            || text.getEndIndex() <= text.getBeginIndex()) {
        return;
    }
    long time = System.currentTimeMillis();
    dispatchingCommittedText = true;
    try {
        InputMethodRequests req = client.getInputMethodRequests();
        if (req != null) {
            // active client -> send text as InputMethodEvent
            int beginIndex = text.getBeginIndex();
            AttributedCharacterIterator toBeCommitted =
                (new AttributedString(text, beginIndex, beginIndex + committedCharacterCount)).getIterator();

            InputMethodEvent inputEvent = new InputMethodEvent(
                    client,
                    InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
                    toBeCommitted,
                    committedCharacterCount,
                    null, null);

            client.dispatchEvent(inputEvent);
        } else {
            // passive client -> send text as KeyEvents
            char keyChar = text.first();
            while (committedCharacterCount-- > 0 && keyChar != CharacterIterator.DONE) {
                KeyEvent keyEvent = new KeyEvent(client, KeyEvent.KEY_TYPED,
                                             time, 0, KeyEvent.VK_UNDEFINED, keyChar);
                client.dispatchEvent(keyEvent);
                keyChar = text.next();
            }
        }
    } finally {
        dispatchingCommittedText = false;
    }
}
 
Example 16
Source File: InputMethodContext.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Dispatches committed text to a client component.
 * Called by composition window.
 *
 * @param client The component that the text should get dispatched to.
 * @param text The iterator providing access to the committed
 *        (and possible composed) text.
 * @param committedCharacterCount The number of committed characters in the text.
 */
synchronized void dispatchCommittedText(Component client,
             AttributedCharacterIterator text,
             int committedCharacterCount) {
    // note that the client is not always the current client component -
    // some host input method adapters may dispatch input method events
    // through the Java event queue, and we may have switched clients while
    // the event was in the queue.
    if (committedCharacterCount == 0
            || text.getEndIndex() <= text.getBeginIndex()) {
        return;
    }
    long time = System.currentTimeMillis();
    dispatchingCommittedText = true;
    try {
        InputMethodRequests req = client.getInputMethodRequests();
        if (req != null) {
            // active client -> send text as InputMethodEvent
            int beginIndex = text.getBeginIndex();
            AttributedCharacterIterator toBeCommitted =
                (new AttributedString(text, beginIndex, beginIndex + committedCharacterCount)).getIterator();

            InputMethodEvent inputEvent = new InputMethodEvent(
                    client,
                    InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
                    toBeCommitted,
                    committedCharacterCount,
                    null, null);

            client.dispatchEvent(inputEvent);
        } else {
            // passive client -> send text as KeyEvents
            char keyChar = text.first();
            while (committedCharacterCount-- > 0 && keyChar != CharacterIterator.DONE) {
                KeyEvent keyEvent = new KeyEvent(client, KeyEvent.KEY_TYPED,
                                             time, 0, KeyEvent.VK_UNDEFINED, keyChar);
                client.dispatchEvent(keyEvent);
                keyChar = text.next();
            }
        }
    } finally {
        dispatchingCommittedText = false;
    }
}
 
Example 17
Source File: InputMethodContext.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Dispatches committed text to a client component.
 * Called by composition window.
 *
 * @param client The component that the text should get dispatched to.
 * @param text The iterator providing access to the committed
 *        (and possible composed) text.
 * @param committedCharacterCount The number of committed characters in the text.
 */
synchronized void dispatchCommittedText(Component client,
             AttributedCharacterIterator text,
             int committedCharacterCount) {
    // note that the client is not always the current client component -
    // some host input method adapters may dispatch input method events
    // through the Java event queue, and we may have switched clients while
    // the event was in the queue.
    if (committedCharacterCount == 0
            || text.getEndIndex() <= text.getBeginIndex()) {
        return;
    }
    long time = System.currentTimeMillis();
    dispatchingCommittedText = true;
    try {
        InputMethodRequests req = client.getInputMethodRequests();
        if (req != null) {
            // active client -> send text as InputMethodEvent
            int beginIndex = text.getBeginIndex();
            AttributedCharacterIterator toBeCommitted =
                (new AttributedString(text, beginIndex, beginIndex + committedCharacterCount)).getIterator();

            InputMethodEvent inputEvent = new InputMethodEvent(
                    client,
                    InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
                    toBeCommitted,
                    committedCharacterCount,
                    null, null);

            client.dispatchEvent(inputEvent);
        } else {
            // passive client -> send text as KeyEvents
            char keyChar = text.first();
            while (committedCharacterCount-- > 0 && keyChar != CharacterIterator.DONE) {
                KeyEvent keyEvent = new KeyEvent(client, KeyEvent.KEY_TYPED,
                                             time, 0, KeyEvent.VK_UNDEFINED, keyChar);
                client.dispatchEvent(keyEvent);
                keyChar = text.next();
            }
        }
    } finally {
        dispatchingCommittedText = false;
    }
}
 
Example 18
Source File: InputMethodContext.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Dispatches committed text to a client component.
 * Called by composition window.
 *
 * @param client The component that the text should get dispatched to.
 * @param text The iterator providing access to the committed
 *        (and possible composed) text.
 * @param committedCharacterCount The number of committed characters in the text.
 */
synchronized void dispatchCommittedText(Component client,
             AttributedCharacterIterator text,
             int committedCharacterCount) {
    // note that the client is not always the current client component -
    // some host input method adapters may dispatch input method events
    // through the Java event queue, and we may have switched clients while
    // the event was in the queue.
    if (committedCharacterCount == 0
            || text.getEndIndex() <= text.getBeginIndex()) {
        return;
    }
    long time = System.currentTimeMillis();
    dispatchingCommittedText = true;
    try {
        InputMethodRequests req = client.getInputMethodRequests();
        if (req != null) {
            // active client -> send text as InputMethodEvent
            int beginIndex = text.getBeginIndex();
            AttributedCharacterIterator toBeCommitted =
                (new AttributedString(text, beginIndex, beginIndex + committedCharacterCount)).getIterator();

            InputMethodEvent inputEvent = new InputMethodEvent(
                    client,
                    InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
                    toBeCommitted,
                    committedCharacterCount,
                    null, null);

            client.dispatchEvent(inputEvent);
        } else {
            // passive client -> send text as KeyEvents
            char keyChar = text.first();
            while (committedCharacterCount-- > 0 && keyChar != CharacterIterator.DONE) {
                KeyEvent keyEvent = new KeyEvent(client, KeyEvent.KEY_TYPED,
                                             time, 0, KeyEvent.VK_UNDEFINED, keyChar);
                client.dispatchEvent(keyEvent);
                keyChar = text.next();
            }
        }
    } finally {
        dispatchingCommittedText = false;
    }
}
 
Example 19
Source File: InputMethodContext.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Dispatches committed text to a client component.
 * Called by composition window.
 *
 * @param client The component that the text should get dispatched to.
 * @param text The iterator providing access to the committed
 *        (and possible composed) text.
 * @param committedCharacterCount The number of committed characters in the text.
 */
synchronized void dispatchCommittedText(Component client,
             AttributedCharacterIterator text,
             int committedCharacterCount) {
    // note that the client is not always the current client component -
    // some host input method adapters may dispatch input method events
    // through the Java event queue, and we may have switched clients while
    // the event was in the queue.
    if (committedCharacterCount == 0
            || text.getEndIndex() <= text.getBeginIndex()) {
        return;
    }
    long time = System.currentTimeMillis();
    dispatchingCommittedText = true;
    try {
        InputMethodRequests req = client.getInputMethodRequests();
        if (req != null) {
            // active client -> send text as InputMethodEvent
            int beginIndex = text.getBeginIndex();
            AttributedCharacterIterator toBeCommitted =
                (new AttributedString(text, beginIndex, beginIndex + committedCharacterCount)).getIterator();

            InputMethodEvent inputEvent = new InputMethodEvent(
                    client,
                    InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
                    toBeCommitted,
                    committedCharacterCount,
                    null, null);

            client.dispatchEvent(inputEvent);
        } else {
            // passive client -> send text as KeyEvents
            char keyChar = text.first();
            while (committedCharacterCount-- > 0 && keyChar != CharacterIterator.DONE) {
                KeyEvent keyEvent = new KeyEvent(client, KeyEvent.KEY_TYPED,
                                             time, 0, KeyEvent.VK_UNDEFINED, keyChar);
                client.dispatchEvent(keyEvent);
                keyChar = text.next();
            }
        }
    } finally {
        dispatchingCommittedText = false;
    }
}
 
Example 20
Source File: InputMethodContext.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Dispatches committed text to a client component.
 * Called by composition window.
 *
 * @param client The component that the text should get dispatched to.
 * @param text The iterator providing access to the committed
 *        (and possible composed) text.
 * @param committedCharacterCount The number of committed characters in the text.
 */
synchronized void dispatchCommittedText(Component client,
             AttributedCharacterIterator text,
             int committedCharacterCount) {
    // note that the client is not always the current client component -
    // some host input method adapters may dispatch input method events
    // through the Java event queue, and we may have switched clients while
    // the event was in the queue.
    if (committedCharacterCount == 0
            || text.getEndIndex() <= text.getBeginIndex()) {
        return;
    }
    long time = System.currentTimeMillis();
    dispatchingCommittedText = true;
    try {
        InputMethodRequests req = client.getInputMethodRequests();
        if (req != null) {
            // active client -> send text as InputMethodEvent
            int beginIndex = text.getBeginIndex();
            AttributedCharacterIterator toBeCommitted =
                (new AttributedString(text, beginIndex, beginIndex + committedCharacterCount)).getIterator();

            InputMethodEvent inputEvent = new InputMethodEvent(
                    client,
                    InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
                    toBeCommitted,
                    committedCharacterCount,
                    null, null);

            client.dispatchEvent(inputEvent);
        } else {
            // passive client -> send text as KeyEvents
            char keyChar = text.first();
            while (committedCharacterCount-- > 0 && keyChar != CharacterIterator.DONE) {
                KeyEvent keyEvent = new KeyEvent(client, KeyEvent.KEY_TYPED,
                                             time, 0, KeyEvent.VK_UNDEFINED, keyChar);
                client.dispatchEvent(keyEvent);
                keyChar = text.next();
            }
        }
    } finally {
        dispatchingCommittedText = false;
    }
}