Java 类java.awt.event.InputMethodListener 实例源码

项目:cn1    文件:Component.java   
@SuppressWarnings("unchecked")
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
    if (ComponentListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getComponentListeners();
    } else if (FocusListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getFocusListeners();
    } else if (HierarchyBoundsListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getHierarchyBoundsListeners();
    } else if (HierarchyListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getHierarchyListeners();
    } else if (InputMethodListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getInputMethodListeners();
    } else if (KeyListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getKeyListeners();
    } else if (MouseWheelListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getMouseWheelListeners();
    } else if (MouseMotionListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getMouseMotionListeners();
    } else if (MouseListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getMouseListeners();
    } else if (PropertyChangeListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getPropertyChangeListeners();
    }
    return (T[]) Array.newInstance(listenerType, 0);
}
项目:freeVM    文件:Component.java   
@SuppressWarnings("unchecked")
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
    if (ComponentListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getComponentListeners();
    } else if (FocusListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getFocusListeners();
    } else if (HierarchyBoundsListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getHierarchyBoundsListeners();
    } else if (HierarchyListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getHierarchyListeners();
    } else if (InputMethodListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getInputMethodListeners();
    } else if (KeyListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getKeyListeners();
    } else if (MouseWheelListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getMouseWheelListeners();
    } else if (MouseMotionListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getMouseMotionListeners();
    } else if (MouseListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getMouseListeners();
    } else if (PropertyChangeListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getPropertyChangeListeners();
    }
    return (T[]) Array.newInstance(listenerType, 0);
}
项目:freeVM    文件:Component.java   
@SuppressWarnings("unchecked")
public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
    if (ComponentListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getComponentListeners();
    } else if (FocusListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getFocusListeners();
    } else if (HierarchyBoundsListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getHierarchyBoundsListeners();
    } else if (HierarchyListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getHierarchyListeners();
    } else if (InputMethodListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getInputMethodListeners();
    } else if (KeyListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getKeyListeners();
    } else if (MouseWheelListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getMouseWheelListeners();
    } else if (MouseMotionListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getMouseMotionListeners();
    } else if (MouseListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getMouseListeners();
    } else if (PropertyChangeListener.class.isAssignableFrom(listenerType)) {
        return (T[]) getPropertyChangeListeners();
    }
    return (T[]) Array.newInstance(listenerType, 0);
}
项目:openjdk-jdk10    文件:ComponentOperator.java   
/**
 * Maps {@code Component.addInputMethodListener(InputMethodListener)}
 * through queue
 */
public void addInputMethodListener(final InputMethodListener inputMethodListener) {
    runMapping(new MapVoidAction("addInputMethodListener") {
        @Override
        public void map() {
            getSource().addInputMethodListener(inputMethodListener);
        }
    });
}
项目:openjdk-jdk10    文件:ComponentOperator.java   
/**
 * Maps
 * {@code Component.removeInputMethodListener(InputMethodListener)}
 * through queue
 */
public void removeInputMethodListener(final InputMethodListener inputMethodListener) {
    runMapping(new MapVoidAction("removeInputMethodListener") {
        @Override
        public void map() {
            getSource().removeInputMethodListener(inputMethodListener);
        }
    });
}
项目:openjdk9    文件:ComponentOperator.java   
/**
 * Maps {@code Component.addInputMethodListener(InputMethodListener)}
 * through queue
 */
public void addInputMethodListener(final InputMethodListener inputMethodListener) {
    runMapping(new MapVoidAction("addInputMethodListener") {
        @Override
        public void map() {
            getSource().addInputMethodListener(inputMethodListener);
        }
    });
}
项目:openjdk9    文件:ComponentOperator.java   
/**
 * Maps
 * {@code Component.removeInputMethodListener(InputMethodListener)}
 * through queue
 */
public void removeInputMethodListener(final InputMethodListener inputMethodListener) {
    runMapping(new MapVoidAction("removeInputMethodListener") {
        @Override
        public void map() {
            getSource().removeInputMethodListener(inputMethodListener);
        }
    });
}
项目:lippen-network-tool    文件:IPV4Field.java   
@Override
public void addInputMethodListener(InputMethodListener listener) {
    if (this.ipFields != null) {
        for (JIPV4Field field : this.ipFields) {
            field.addInputMethodListener(listener);
        }
    }
}
项目:lippen-network-tool    文件:IPV4Field.java   
@Override
public void removeInputMethodListener(InputMethodListener listener) {
    if (this.ipFields != null) {
        for (JIPV4Field field : this.ipFields) {
            field.removeInputMethodListener(listener);
        }
    }
}
项目:javify    文件:Component.java   
/**
 * Deserializes this component. This regenerates all serializable listeners
 * which were registered originally.
 *
 * @param s the stream to read from
 * @throws ClassNotFoundException if deserialization fails
 * @throws IOException if the stream fails
 */
private void readObject(ObjectInputStream s)
  throws ClassNotFoundException, IOException
{
  s.defaultReadObject();
  String key = (String) s.readObject();
  while (key != null)
    {
      Object listener = s.readObject();
      if ("componentL".equals(key))
        addComponentListener((ComponentListener) listener);
      else if ("focusL".equals(key))
        addFocusListener((FocusListener) listener);
      else if ("keyL".equals(key))
        addKeyListener((KeyListener) listener);
      else if ("mouseL".equals(key))
        addMouseListener((MouseListener) listener);
      else if ("mouseMotionL".equals(key))
        addMouseMotionListener((MouseMotionListener) listener);
      else if ("inputMethodL".equals(key))
        addInputMethodListener((InputMethodListener) listener);
      else if ("hierarchyL".equals(key))
        addHierarchyListener((HierarchyListener) listener);
      else if ("hierarchyBoundsL".equals(key))
        addHierarchyBoundsListener((HierarchyBoundsListener) listener);
      else if ("mouseWheelL".equals(key))
        addMouseWheelListener((MouseWheelListener) listener);
      key = (String) s.readObject();
    }
}
项目:javify    文件:StandaloneAppletWindow.java   
/**
 * This method is called when the text is changed.
 *
 * @param event the <code>InputMethodEvent</code> indicating the text change
 */
public void inputMethodTextChanged(InputMethodEvent event)
{
  if (applet != null)
    {
      InputMethodListener[] l = applet.getInputMethodListeners();
      for (int i = 0; i < l.length; i++)
        l[i].inputMethodTextChanged(event);
    }
}
项目:javify    文件:StandaloneAppletWindow.java   
/**
 * This method is called when the cursor position within the text is changed.
 *
 * @param event the <code>InputMethodEvent</code> indicating the change
 */
public void caretPositionChanged(InputMethodEvent event)
{
  if (applet != null)
    {
      InputMethodListener[] l = applet.getInputMethodListeners();
      for (int i = 0; i < l.length; i++)
        l[i].caretPositionChanged(event);
    }
}
项目:javify    文件:PluginAppletWindow.java   
/**
 * This method is called when the text is changed.
 *
 * @param event the <code>InputMethodEvent</code> indicating the text change
 */
public void inputMethodTextChanged(InputMethodEvent event)
{
  if (applet != null)
    {
      InputMethodListener[] l = applet.getInputMethodListeners();
      for (int i = 0; i < l.length; i++)
        l[i].inputMethodTextChanged(event);
    }
}
项目:javify    文件:PluginAppletWindow.java   
/**
 * This method is called when the cursor position within the text is changed.
 *
 * @param event the <code>InputMethodEvent</code> indicating the change
 */
public void caretPositionChanged(InputMethodEvent event)
{
  if (applet != null)
    {
      InputMethodListener[] l = applet.getInputMethodListeners();
      for (int i = 0; i < l.length; i++)
        l[i].caretPositionChanged(event);
    }
}
项目:jvm-stm    文件:Component.java   
/**
 * Deserializes this component. This regenerates all serializable listeners
 * which were registered originally.
 *
 * @param s the stream to read from
 * @throws ClassNotFoundException if deserialization fails
 * @throws IOException if the stream fails
 */
private void readObject(ObjectInputStream s)
  throws ClassNotFoundException, IOException
{
  s.defaultReadObject();
  String key = (String) s.readObject();
  while (key != null)
    {
      Object listener = s.readObject();
      if ("componentL".equals(key))
        addComponentListener((ComponentListener) listener);
      else if ("focusL".equals(key))
        addFocusListener((FocusListener) listener);
      else if ("keyL".equals(key))
        addKeyListener((KeyListener) listener);
      else if ("mouseL".equals(key))
        addMouseListener((MouseListener) listener);
      else if ("mouseMotionL".equals(key))
        addMouseMotionListener((MouseMotionListener) listener);
      else if ("inputMethodL".equals(key))
        addInputMethodListener((InputMethodListener) listener);
      else if ("hierarchyL".equals(key))
        addHierarchyListener((HierarchyListener) listener);
      else if ("hierarchyBoundsL".equals(key))
        addHierarchyBoundsListener((HierarchyBoundsListener) listener);
      else if ("mouseWheelL".equals(key))
        addMouseWheelListener((MouseWheelListener) listener);
      key = (String) s.readObject();
    }
}
项目:jvm-stm    文件:StandaloneAppletWindow.java   
/**
 * This method is called when the text is changed.
 *
 * @param event the <code>InputMethodEvent</code> indicating the text change
 */
public void inputMethodTextChanged(InputMethodEvent event)
{
  if (applet != null)
    {
      InputMethodListener[] l = applet.getInputMethodListeners();
      for (int i = 0; i < l.length; i++)
        l[i].inputMethodTextChanged(event);
    }
}
项目:jvm-stm    文件:StandaloneAppletWindow.java   
/**
 * This method is called when the cursor position within the text is changed.
 *
 * @param event the <code>InputMethodEvent</code> indicating the change
 */
public void caretPositionChanged(InputMethodEvent event)
{
  if (applet != null)
    {
      InputMethodListener[] l = applet.getInputMethodListeners();
      for (int i = 0; i < l.length; i++)
        l[i].caretPositionChanged(event);
    }
}
项目:jvm-stm    文件:PluginAppletWindow.java   
/**
 * This method is called when the text is changed.
 *
 * @param event the <code>InputMethodEvent</code> indicating the text change
 */
public void inputMethodTextChanged(InputMethodEvent event)
{
  if (applet != null)
    {
      InputMethodListener[] l = applet.getInputMethodListeners();
      for (int i = 0; i < l.length; i++)
        l[i].inputMethodTextChanged(event);
    }
}
项目:jvm-stm    文件:PluginAppletWindow.java   
/**
 * This method is called when the cursor position within the text is changed.
 *
 * @param event the <code>InputMethodEvent</code> indicating the change
 */
public void caretPositionChanged(InputMethodEvent event)
{
  if (applet != null)
    {
      InputMethodListener[] l = applet.getInputMethodListeners();
      for (int i = 0; i < l.length; i++)
        l[i].caretPositionChanged(event);
    }
}
项目:java-ui-factory    文件:JTextComponentFactory.java   
@Override
public void wireComponent(final ComponentContext context) {
    super.wireComponent(context);

    final JTextComponent component = (JTextComponent) context
            .getComponent();

    final MethodListenerProxy<InputMethodListener> inputMethodListenerProxy = new MethodListenerProxy<InputMethodListener>(
            InputMethodListener.class, context.getActionListeners());

    if (inputMethodListenerProxy.hasListeningMethod()) {
        component.addInputMethodListener(inputMethodListenerProxy
                .getProxy());
    }
}
项目:cn1    文件:AWTEventMulticaster.java   
public void caretPositionChanged(InputMethodEvent e) {
    if ((a != null) && (a instanceof InputMethodListener)) {
        ((InputMethodListener) a).caretPositionChanged(e);
    }
    if ((b != null) && (b instanceof InputMethodListener)) {
        ((InputMethodListener) b).caretPositionChanged(e);
    }
}
项目:cn1    文件:AWTEventMulticaster.java   
public void inputMethodTextChanged(InputMethodEvent e) {
    if ((a != null) && (a instanceof InputMethodListener)) {
        ((InputMethodListener) a).inputMethodTextChanged(e);
    }
    if ((b != null) && (b instanceof InputMethodListener)) {
        ((InputMethodListener) b).inputMethodTextChanged(e);
    }
}
项目:cn1    文件:Component.java   
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;
        }
    }
}
项目:cn1    文件:TextUtils.java   
public static void processIMEvent(final InputMethodListener listener,
                             final InputMethodEvent e) {
    if (e.getID() == InputMethodEvent.CARET_POSITION_CHANGED) {
        listener.caretPositionChanged(e);
    }
    if (e.getID() == InputMethodEvent.INPUT_METHOD_TEXT_CHANGED) {
        listener.inputMethodTextChanged(e);
    }
}
项目:cn1    文件:JTextComponentTest.java   
public void testAddInputMethodListener() {
    SimpleInputMethodListener listener1 = new SimpleInputMethodListener("1");
    SimpleInputMethodListener listener2 = new SimpleInputMethodListener("2");
    SimpleInputMethodListener listener3 = new SimpleInputMethodListener("3");
    jtc.addInputMethodListener(listener1);
    jtc.addInputMethodListener(listener2);
    jtc.addInputMethodListener(listener3);
    InputMethodListener listeners[] = jtc.getInputMethodListeners();
    assertEquals(listener1, listeners[0]);
    assertEquals(listener2, listeners[1]);
    assertEquals(listener3, listeners[2]);
    assertEquals(3, listeners.length);
}
项目:JamVM-PH    文件:Component.java   
/**
 * Deserializes this component. This regenerates all serializable listeners
 * which were registered originally.
 *
 * @param s the stream to read from
 * @throws ClassNotFoundException if deserialization fails
 * @throws IOException if the stream fails
 */
private void readObject(ObjectInputStream s)
  throws ClassNotFoundException, IOException
{
  s.defaultReadObject();
  String key = (String) s.readObject();
  while (key != null)
    {
      Object listener = s.readObject();
      if ("componentL".equals(key))
        addComponentListener((ComponentListener) listener);
      else if ("focusL".equals(key))
        addFocusListener((FocusListener) listener);
      else if ("keyL".equals(key))
        addKeyListener((KeyListener) listener);
      else if ("mouseL".equals(key))
        addMouseListener((MouseListener) listener);
      else if ("mouseMotionL".equals(key))
        addMouseMotionListener((MouseMotionListener) listener);
      else if ("inputMethodL".equals(key))
        addInputMethodListener((InputMethodListener) listener);
      else if ("hierarchyL".equals(key))
        addHierarchyListener((HierarchyListener) listener);
      else if ("hierarchyBoundsL".equals(key))
        addHierarchyBoundsListener((HierarchyBoundsListener) listener);
      else if ("mouseWheelL".equals(key))
        addMouseWheelListener((MouseWheelListener) listener);
      key = (String) s.readObject();
    }
}
项目:JamVM-PH    文件:StandaloneAppletWindow.java   
/**
 * This method is called when the text is changed.
 *
 * @param event the <code>InputMethodEvent</code> indicating the text change
 */
public void inputMethodTextChanged(InputMethodEvent event)
{
  if (applet != null)
    {
      InputMethodListener[] l = applet.getInputMethodListeners();
      for (int i = 0; i < l.length; i++)
        l[i].inputMethodTextChanged(event);
    }
}
项目:JamVM-PH    文件:StandaloneAppletWindow.java   
/**
 * This method is called when the cursor position within the text is changed.
 *
 * @param event the <code>InputMethodEvent</code> indicating the change
 */
public void caretPositionChanged(InputMethodEvent event)
{
  if (applet != null)
    {
      InputMethodListener[] l = applet.getInputMethodListeners();
      for (int i = 0; i < l.length; i++)
        l[i].caretPositionChanged(event);
    }
}
项目:JamVM-PH    文件:PluginAppletWindow.java   
/**
 * This method is called when the text is changed.
 *
 * @param event the <code>InputMethodEvent</code> indicating the text change
 */
public void inputMethodTextChanged(InputMethodEvent event)
{
  if (applet != null)
    {
      InputMethodListener[] l = applet.getInputMethodListeners();
      for (int i = 0; i < l.length; i++)
        l[i].inputMethodTextChanged(event);
    }
}
项目:JamVM-PH    文件:PluginAppletWindow.java   
/**
 * This method is called when the cursor position within the text is changed.
 *
 * @param event the <code>InputMethodEvent</code> indicating the change
 */
public void caretPositionChanged(InputMethodEvent event)
{
  if (applet != null)
    {
      InputMethodListener[] l = applet.getInputMethodListeners();
      for (int i = 0; i < l.length; i++)
        l[i].caretPositionChanged(event);
    }
}
项目:classpath    文件:Component.java   
/**
 * Deserializes this component. This regenerates all serializable listeners
 * which were registered originally.
 *
 * @param s the stream to read from
 * @throws ClassNotFoundException if deserialization fails
 * @throws IOException if the stream fails
 */
private void readObject(ObjectInputStream s)
  throws ClassNotFoundException, IOException
{
  s.defaultReadObject();
  String key = (String) s.readObject();
  while (key != null)
    {
      Object listener = s.readObject();
      if ("componentL".equals(key))
        addComponentListener((ComponentListener) listener);
      else if ("focusL".equals(key))
        addFocusListener((FocusListener) listener);
      else if ("keyL".equals(key))
        addKeyListener((KeyListener) listener);
      else if ("mouseL".equals(key))
        addMouseListener((MouseListener) listener);
      else if ("mouseMotionL".equals(key))
        addMouseMotionListener((MouseMotionListener) listener);
      else if ("inputMethodL".equals(key))
        addInputMethodListener((InputMethodListener) listener);
      else if ("hierarchyL".equals(key))
        addHierarchyListener((HierarchyListener) listener);
      else if ("hierarchyBoundsL".equals(key))
        addHierarchyBoundsListener((HierarchyBoundsListener) listener);
      else if ("mouseWheelL".equals(key))
        addMouseWheelListener((MouseWheelListener) listener);
      key = (String) s.readObject();
    }
}
项目:classpath    文件:StandaloneAppletWindow.java   
/**
 * This method is called when the text is changed.
 *
 * @param event the <code>InputMethodEvent</code> indicating the text change
 */
public void inputMethodTextChanged(InputMethodEvent event)
{
  if (applet != null)
    {
      InputMethodListener[] l = applet.getInputMethodListeners();
      for (int i = 0; i < l.length; i++)
        l[i].inputMethodTextChanged(event);
    }
}
项目:classpath    文件:StandaloneAppletWindow.java   
/**
 * This method is called when the cursor position within the text is changed.
 *
 * @param event the <code>InputMethodEvent</code> indicating the change
 */
public void caretPositionChanged(InputMethodEvent event)
{
  if (applet != null)
    {
      InputMethodListener[] l = applet.getInputMethodListeners();
      for (int i = 0; i < l.length; i++)
        l[i].caretPositionChanged(event);
    }
}
项目:classpath    文件:PluginAppletWindow.java   
/**
 * This method is called when the text is changed.
 *
 * @param event the <code>InputMethodEvent</code> indicating the text change
 */
public void inputMethodTextChanged(InputMethodEvent event)
{
  if (applet != null)
    {
      InputMethodListener[] l = applet.getInputMethodListeners();
      for (int i = 0; i < l.length; i++)
        l[i].inputMethodTextChanged(event);
    }
}
项目:classpath    文件:PluginAppletWindow.java   
/**
 * This method is called when the cursor position within the text is changed.
 *
 * @param event the <code>InputMethodEvent</code> indicating the change
 */
public void caretPositionChanged(InputMethodEvent event)
{
  if (applet != null)
    {
      InputMethodListener[] l = applet.getInputMethodListeners();
      for (int i = 0; i < l.length; i++)
        l[i].caretPositionChanged(event);
    }
}
项目:freeVM    文件:AWTEventMulticaster.java   
public void caretPositionChanged(InputMethodEvent e) {
    if ((a != null) && (a instanceof InputMethodListener)) {
        ((InputMethodListener) a).caretPositionChanged(e);
    }
    if ((b != null) && (b instanceof InputMethodListener)) {
        ((InputMethodListener) b).caretPositionChanged(e);
    }
}
项目:freeVM    文件:AWTEventMulticaster.java   
public void inputMethodTextChanged(InputMethodEvent e) {
    if ((a != null) && (a instanceof InputMethodListener)) {
        ((InputMethodListener) a).inputMethodTextChanged(e);
    }
    if ((b != null) && (b instanceof InputMethodListener)) {
        ((InputMethodListener) b).inputMethodTextChanged(e);
    }
}
项目:freeVM    文件:Component.java   
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;
        }
    }
}
项目:freeVM    文件:TextUtils.java   
public static void processIMEvent(final InputMethodListener listener,
                             final InputMethodEvent e) {
    if (e.getID() == InputMethodEvent.CARET_POSITION_CHANGED) {
        listener.caretPositionChanged(e);
    }
    if (e.getID() == InputMethodEvent.INPUT_METHOD_TEXT_CHANGED) {
        listener.inputMethodTextChanged(e);
    }
}
项目:freeVM    文件:JTextComponentTest.java   
public void testAddInputMethodListener() {
    SimpleInputMethodListener listener1 = new SimpleInputMethodListener("1");
    SimpleInputMethodListener listener2 = new SimpleInputMethodListener("2");
    SimpleInputMethodListener listener3 = new SimpleInputMethodListener("3");
    jtc.addInputMethodListener(listener1);
    jtc.addInputMethodListener(listener2);
    jtc.addInputMethodListener(listener3);
    InputMethodListener listeners[] = jtc.getInputMethodListeners();
    assertEquals(listener1, listeners[0]);
    assertEquals(listener2, listeners[1]);
    assertEquals(listener3, listeners[2]);
    assertEquals(3, listeners.length);
}