當前位置: 首頁>>代碼示例>>Java>>正文


Java InputMethodEvent.INPUT_METHOD_TEXT_CHANGED屬性代碼示例

本文整理匯總了Java中java.awt.event.InputMethodEvent.INPUT_METHOD_TEXT_CHANGED屬性的典型用法代碼示例。如果您正苦於以下問題:Java InputMethodEvent.INPUT_METHOD_TEXT_CHANGED屬性的具體用法?Java InputMethodEvent.INPUT_METHOD_TEXT_CHANGED怎麽用?Java InputMethodEvent.INPUT_METHOD_TEXT_CHANGED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在java.awt.event.InputMethodEvent的用法示例。


在下文中一共展示了InputMethodEvent.INPUT_METHOD_TEXT_CHANGED屬性的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processInputMethodEvent

@Override
protected void processInputMethodEvent(InputMethodEvent e) {
  super.processInputMethodEvent(e);
  if (!e.isConsumed()) {
    switch (e.getID()) {
      case InputMethodEvent.INPUT_METHOD_TEXT_CHANGED:
        myEditor.replaceInputMethodText(e);
        // No breaks over here.

        //noinspection fallthrough
      case InputMethodEvent.CARET_POSITION_CHANGED:
        myEditor.inputMethodCaretPositionChanged(e);
        break;
    }
    e.consume();
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:EditorComponentImpl.java

示例2: processInputMethodEventImpl

private void processInputMethodEventImpl(InputMethodEvent e,
        Collection<InputMethodListener> c) {
    for (InputMethodListener listener : c) {
        switch (e.getID()) {
            case InputMethodEvent.CARET_POSITION_CHANGED:
                listener.caretPositionChanged(e);
                break;
            case InputMethodEvent.INPUT_METHOD_TEXT_CHANGED:
                listener.inputMethodTextChanged(e);
                break;
        }
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:13,代碼來源:Component.java

示例3: processInputMethodEvent

void processInputMethodEvent(InputMethodEvent event) {
    if (event.getID() == InputMethodEvent.INPUT_METHOD_TEXT_CHANGED) {
        inputMethodTextChanged(event);
    } else {
        caretPositionChanged(event);
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:7,代碼來源:CompositionAreaHandler.java

示例4: dispatchCommittedText

/**
 * 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;
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:52,代碼來源:InputMethodContext.java

示例5: sendInputMethodEvent

void sendInputMethodEvent() {
    InputMethodEvent ime = new InputMethodEvent(
            ep,
            InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
            Hiragana_A.getIterator(),
            0,
            null,
            null);
    ep.dispatchEvent(ime);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:10,代碼來源:bug6636983.java

示例6: processInputMethodEvent

/**
 * Called when an input method event is dispatched and component events are
 * enabled. This method passes the event along to any listeners that are
 * attached.
 *
 * @param e the <code>InputMethodEvent</code> to process
 * @throws NullPointerException if e is null
 * @see InputMethodListener
 * @see #addInputMethodListener(InputMethodListener)
 * @see #enableEvents(long)
 * @since 1.2
 */
protected void processInputMethodEvent(InputMethodEvent e)
{
  if (inputMethodListener == null)
    return;
  switch (e.id)
    {
      case InputMethodEvent.CARET_POSITION_CHANGED:
        inputMethodListener.caretPositionChanged(e);
      break;
      case InputMethodEvent.INPUT_METHOD_TEXT_CHANGED:
        inputMethodListener.inputMethodTextChanged(e);
      break;
    }
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:26,代碼來源:Component.java

示例7: processInputMethodEvent

@Override
protected void processInputMethodEvent(InputMethodEvent e) {
    if (e.getID() == InputMethodEvent.INPUT_METHOD_TEXT_CHANGED) {
        sendInputMethodEventToFX(e);
    }

}
 
開發者ID:JabRef,項目名稱:jabref,代碼行數:7,代碼來源:CustomJFXPanel.java

示例8: eventTypeEnabled

/**
 * Tells whether or not an event type is enabled.
 */
boolean eventTypeEnabled (int type)
{
  if (type > AWTEvent.RESERVED_ID_MAX)
    return true;

  switch (type)
    {
    case HierarchyEvent.HIERARCHY_CHANGED:
      return (hierarchyListener != null
          || (eventMask & AWTEvent.HIERARCHY_EVENT_MASK) != 0);

    case HierarchyEvent.ANCESTOR_MOVED:
    case HierarchyEvent.ANCESTOR_RESIZED:
      return (hierarchyBoundsListener != null
          || (eventMask & AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK) != 0);

    case ComponentEvent.COMPONENT_HIDDEN:
    case ComponentEvent.COMPONENT_MOVED:
    case ComponentEvent.COMPONENT_RESIZED:
    case ComponentEvent.COMPONENT_SHOWN:
      return (componentListener != null
              || (eventMask & AWTEvent.COMPONENT_EVENT_MASK) != 0);

    case KeyEvent.KEY_PRESSED:
    case KeyEvent.KEY_RELEASED:
    case KeyEvent.KEY_TYPED:
      return (keyListener != null
              || (eventMask & AWTEvent.KEY_EVENT_MASK) != 0);

    case MouseEvent.MOUSE_CLICKED:
    case MouseEvent.MOUSE_ENTERED:
    case MouseEvent.MOUSE_EXITED:
    case MouseEvent.MOUSE_PRESSED:
    case MouseEvent.MOUSE_RELEASED:
      return (mouseListener != null
              || (eventMask & AWTEvent.MOUSE_EVENT_MASK) != 0);
    case MouseEvent.MOUSE_MOVED:
    case MouseEvent.MOUSE_DRAGGED:
      return (mouseMotionListener != null
              || (eventMask & AWTEvent.MOUSE_MOTION_EVENT_MASK) != 0);
    case MouseEvent.MOUSE_WHEEL:
      return (mouseWheelListener != null
              || (eventMask & AWTEvent.MOUSE_WHEEL_EVENT_MASK) != 0);

    case FocusEvent.FOCUS_GAINED:
    case FocusEvent.FOCUS_LOST:
      return (focusListener != null
              || (eventMask & AWTEvent.FOCUS_EVENT_MASK) != 0);

    case InputMethodEvent.INPUT_METHOD_TEXT_CHANGED:
    case InputMethodEvent.CARET_POSITION_CHANGED:
      return (inputMethodListener != null
              || (eventMask & AWTEvent.INPUT_METHOD_EVENT_MASK) != 0);

    case PaintEvent.PAINT:
    case PaintEvent.UPDATE:
      return (eventMask & AWTEvent.PAINT_EVENT_MASK) != 0;

    default:
      return false;
    }
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:65,代碼來源:Component.java

示例9: eventTypeEnabled

/**
 * Tells whether or not an event type is enabled.
 */
boolean eventTypeEnabled (int type)
{
  if (type > AWTEvent.RESERVED_ID_MAX)
    return true;

  switch (type)
    {
    case HierarchyEvent.HIERARCHY_CHANGED:
      return (hierarchyListener != null 
          || (eventMask & AWTEvent.HIERARCHY_EVENT_MASK) != 0);
      
    case HierarchyEvent.ANCESTOR_MOVED:
    case HierarchyEvent.ANCESTOR_RESIZED:
      return (hierarchyBoundsListener != null 
          || (eventMask & AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK) != 0);
      
    case ComponentEvent.COMPONENT_HIDDEN:
    case ComponentEvent.COMPONENT_MOVED:
    case ComponentEvent.COMPONENT_RESIZED:
    case ComponentEvent.COMPONENT_SHOWN:
      return (componentListener != null
              || (eventMask & AWTEvent.COMPONENT_EVENT_MASK) != 0);

    case KeyEvent.KEY_PRESSED:
    case KeyEvent.KEY_RELEASED:
    case KeyEvent.KEY_TYPED:
      return (keyListener != null
              || (eventMask & AWTEvent.KEY_EVENT_MASK) != 0);

    case MouseEvent.MOUSE_CLICKED:
    case MouseEvent.MOUSE_ENTERED:
    case MouseEvent.MOUSE_EXITED:
    case MouseEvent.MOUSE_PRESSED:
    case MouseEvent.MOUSE_RELEASED:
      return (mouseListener != null
              || (eventMask & AWTEvent.MOUSE_EVENT_MASK) != 0);
    case MouseEvent.MOUSE_MOVED:
    case MouseEvent.MOUSE_DRAGGED:
      return (mouseMotionListener != null
              || (eventMask & AWTEvent.MOUSE_MOTION_EVENT_MASK) != 0);
    case MouseEvent.MOUSE_WHEEL:
      return (mouseWheelListener != null
              || (eventMask & AWTEvent.MOUSE_WHEEL_EVENT_MASK) != 0);
      
    case FocusEvent.FOCUS_GAINED:
    case FocusEvent.FOCUS_LOST:
      return (focusListener != null
              || (eventMask & AWTEvent.FOCUS_EVENT_MASK) != 0);

    case InputMethodEvent.INPUT_METHOD_TEXT_CHANGED:
    case InputMethodEvent.CARET_POSITION_CHANGED:
      return (inputMethodListener != null
              || (eventMask & AWTEvent.INPUT_METHOD_EVENT_MASK) != 0);
      
    case PaintEvent.PAINT:
    case PaintEvent.UPDATE:
      return (eventMask & AWTEvent.PAINT_EVENT_MASK) != 0;
      
    default:
      return false;
    }
}
 
開發者ID:nmldiegues,項目名稱:jvm-stm,代碼行數:65,代碼來源:Component.java

示例10: processInputMethodEvent

/**
 * Processes input method events occurring on this component by
 * dispatching them to any registered
 * <code>InputMethodListener</code> objects.
 * <p>
 * This method is not called unless input method events
 * are enabled for this component. Input method events are enabled
 * when one of the following occurs:
 * <p><ul>
 * <li>An <code>InputMethodListener</code> object is registered
 * via <code>addInputMethodListener</code>.
 * <li>Input method events are enabled via <code>enableEvents</code>.
 * </ul>
 * <p>Note that if the event parameter is <code>null</code>
 * the behavior is unspecified and may result in an
 * exception.
 *
 * @param       e the input method event
 * @see         java.awt.event.InputMethodEvent
 * @see         java.awt.event.InputMethodListener
 * @see         #addInputMethodListener
 * @see         #enableEvents
 * @since       1.2
 */
protected void processInputMethodEvent(InputMethodEvent e) {
    InputMethodListener listener = inputMethodListener;
    if (listener != null) {
        int id = e.getID();
        switch (id) {
          case InputMethodEvent.INPUT_METHOD_TEXT_CHANGED:
              listener.inputMethodTextChanged(e);
              break;
          case InputMethodEvent.CARET_POSITION_CHANGED:
              listener.caretPositionChanged(e);
              break;
        }
    }
}
 
開發者ID:jgaltidor,項目名稱:VarJ,代碼行數:38,代碼來源:Component.java

示例11: processInputMethodEvent

/**
 * Processes input method events occurring on this component by
 * dispatching them to any registered
 * <code>InputMethodListener</code> objects.
 * <p>
 * This method is not called unless input method events
 * are enabled for this component. Input method events are enabled
 * when one of the following occurs:
 * <ul>
 * <li>An <code>InputMethodListener</code> object is registered
 * via <code>addInputMethodListener</code>.
 * <li>Input method events are enabled via <code>enableEvents</code>.
 * </ul>
 * <p>Note that if the event parameter is <code>null</code>
 * the behavior is unspecified and may result in an
 * exception.
 *
 * @param       e the input method event
 * @see         java.awt.event.InputMethodEvent
 * @see         java.awt.event.InputMethodListener
 * @see         #addInputMethodListener
 * @see         #enableEvents
 * @since       1.2
 */
protected void processInputMethodEvent(InputMethodEvent e) {
    InputMethodListener listener = inputMethodListener;
    if (listener != null) {
        int id = e.getID();
        switch (id) {
          case InputMethodEvent.INPUT_METHOD_TEXT_CHANGED:
              listener.inputMethodTextChanged(e);
              break;
          case InputMethodEvent.CARET_POSITION_CHANGED:
              listener.caretPositionChanged(e);
              break;
        }
    }
}
 
開發者ID:RedlineResearch,項目名稱:OLD-OpenJDK8,代碼行數:38,代碼來源:Component.java


注:本文中的java.awt.event.InputMethodEvent.INPUT_METHOD_TEXT_CHANGED屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。