Search in sources :

Example 6 with InputMethodEvent

use of java.awt.event.InputMethodEvent in project jdk8u_jdk by JetBrains.

the class InputContext method dispatchEvent.

/**
     * @see java.awt.im.InputContext#dispatchEvent
     */
@SuppressWarnings("fallthrough")
public void dispatchEvent(AWTEvent event) {
    if (event instanceof InputMethodEvent) {
        return;
    }
    // This is a workaround.  Should be removed after 4452384 is fixed.
    if (event instanceof FocusEvent) {
        Component opposite = ((FocusEvent) event).getOppositeComponent();
        if ((opposite != null) && (getComponentWindow(opposite) instanceof InputMethodWindow) && (opposite.getInputContext() == this)) {
            return;
        }
    }
    InputMethod inputMethod = getInputMethod();
    int id = event.getID();
    switch(id) {
        case FocusEvent.FOCUS_GAINED:
            focusGained((Component) event.getSource());
            break;
        case FocusEvent.FOCUS_LOST:
            focusLost((Component) event.getSource(), ((FocusEvent) event).isTemporary());
            break;
        case KeyEvent.KEY_PRESSED:
            if (checkInputMethodSelectionKey((KeyEvent) event)) {
                // pop up the input method selection menu
                InputMethodManager.getInstance().notifyChangeRequestByHotKey((Component) event.getSource());
                break;
            }
        default:
            if ((inputMethod != null) && (event instanceof InputEvent)) {
                inputMethod.dispatchEvent(event);
            }
    }
}
Also used : InputMethod(java.awt.im.spi.InputMethod) InputMethodEvent(java.awt.event.InputMethodEvent) InputEvent(java.awt.event.InputEvent) Component(java.awt.Component) FocusEvent(java.awt.event.FocusEvent)

Example 7 with InputMethodEvent

use of java.awt.event.InputMethodEvent in project jdk8u_jdk by JetBrains.

the class InputMethodContext method dispatchInputMethodEvent.

// implements java.awt.im.spi.InputMethodContext.dispatchInputMethodEvent
public void dispatchInputMethodEvent(int id, AttributedCharacterIterator text, int committedCharacterCount, TextHitInfo caret, TextHitInfo visiblePosition) {
    // We need to record the client component as the source so
    // that we have correct information if we later have to break up this
    // event into key events.
    Component source;
    source = getClientComponent();
    if (source != null) {
        InputMethodEvent event = new InputMethodEvent(source, id, text, committedCharacterCount, caret, visiblePosition);
        if (haveActiveClient() && !useBelowTheSpotInput()) {
            source.dispatchEvent(event);
        } else {
            getCompositionAreaHandler(true).processInputMethodEvent(event);
        }
    }
}
Also used : InputMethodEvent(java.awt.event.InputMethodEvent) Component(java.awt.Component)

Aggregations

InputMethodEvent (java.awt.event.InputMethodEvent)7 Component (java.awt.Component)3 KeyEvent (java.awt.event.KeyEvent)2 MultiLineLabelUI (com.intellij.openapi.ui.MultiLineLabelUI)1 CollectionComboBoxModel (com.intellij.ui.CollectionComboBoxModel)1 GridBagConstraints (java.awt.GridBagConstraints)1 FocusEvent (java.awt.event.FocusEvent)1 InputEvent (java.awt.event.InputEvent)1 InputMethodListener (java.awt.event.InputMethodListener)1 KeyListener (java.awt.event.KeyListener)1 InputMethodRequests (java.awt.im.InputMethodRequests)1 InputMethod (java.awt.im.spi.InputMethod)1 AttributedCharacterIterator (java.text.AttributedCharacterIterator)1 AttributedString (java.text.AttributedString)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 SunToolkit (sun.awt.SunToolkit)1