java.awt.im.spi.InputMethod Java Examples

The following examples show how to use java.awt.im.spi.InputMethod. 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: InputContext.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @return a string with information about the current input method.
 * @exception UnsupportedOperationException when input method is null
 */
public String getInputMethodInfo() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException("Null input method");
    }

    String inputMethodInfo = null;
    if (inputMethod instanceof InputMethodAdapter) {
        // returns the information about the host native input method.
        inputMethodInfo = ((InputMethodAdapter)inputMethod).
            getNativeInputMethodInfo();
    }

    // extracts the information from the InputMethodDescriptor
    // associated with the current java input method.
    if (inputMethodInfo == null && inputMethodLocator != null) {
        inputMethodInfo = inputMethodLocator.getDescriptor().
            getInputMethodDisplayName(getLocale(), SunToolkit.
                                      getStartupLocale());
    }

    if (inputMethodInfo != null && !inputMethodInfo.equals("")) {
        return inputMethodInfo;
    }

    // do our best to return something useful.
    return inputMethod.toString() + "-" + inputMethod.getLocale().toString();
}
 
Example #2
Source File: InputContext.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.InputContext#getInputMethodControlObject
 */
public synchronized Object getInputMethodControlObject() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod != null) {
        return inputMethod.getControlObject();
    } else {
        return null;
    }
}
 
Example #3
Source File: InputContext.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.InputContext#isCompositionEnabled
 * @exception UnsupportedOperationException when input method is null
 */
public boolean isCompositionEnabled() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    return inputMethod.isCompositionEnabled();
}
 
Example #4
Source File: InputContext.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @return a string with information about the current input method.
 * @exception UnsupportedOperationException when input method is null
 */
public String getInputMethodInfo() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException("Null input method");
    }

    String inputMethodInfo = null;
    if (inputMethod instanceof InputMethodAdapter) {
        // returns the information about the host native input method.
        inputMethodInfo = ((InputMethodAdapter)inputMethod).
            getNativeInputMethodInfo();
    }

    // extracts the information from the InputMethodDescriptor
    // associated with the current java input method.
    if (inputMethodInfo == null && inputMethodLocator != null) {
        inputMethodInfo = inputMethodLocator.getDescriptor().
            getInputMethodDisplayName(getLocale(), SunToolkit.
                                      getStartupLocale());
    }

    if (inputMethodInfo != null && !inputMethodInfo.equals("")) {
        return inputMethodInfo;
    }

    // do our best to return something useful.
    return inputMethod.toString() + "-" + inputMethod.getLocale().toString();
}
 
Example #5
Source File: InputContext.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private synchronized InputMethod getInputMethod() {
    if (inputMethod != null) {
        return inputMethod;
    }

    if (inputMethodCreationFailed) {
        return null;
    }

    inputMethod = getInputMethodInstance();
    return inputMethod;
}
 
Example #6
Source File: InputContext.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.InputContext#reconvert
 * @since 1.3
 * @exception UnsupportedOperationException when input method is null
 */
public synchronized void reconvert() {
    InputMethod inputMethod = getInputMethod();
    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    inputMethod.reconvert();
}
 
Example #7
Source File: InputContext.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.InputContext#isCompositionEnabled
 * @exception UnsupportedOperationException when input method is null
 */
public boolean isCompositionEnabled() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    return inputMethod.isCompositionEnabled();
}
 
Example #8
Source File: InputContext.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @return a string with information about the current input method.
 * @exception UnsupportedOperationException when input method is null
 */
public String getInputMethodInfo() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException("Null input method");
    }

    String inputMethodInfo = null;
    if (inputMethod instanceof InputMethodAdapter) {
        // returns the information about the host native input method.
        inputMethodInfo = ((InputMethodAdapter)inputMethod).
            getNativeInputMethodInfo();
    }

    // extracts the information from the InputMethodDescriptor
    // associated with the current java input method.
    if (inputMethodInfo == null && inputMethodLocator != null) {
        inputMethodInfo = inputMethodLocator.getDescriptor().
            getInputMethodDisplayName(getLocale(), SunToolkit.
                                      getStartupLocale());
    }

    if (inputMethodInfo != null && !inputMethodInfo.equals("")) {
        return inputMethodInfo;
    }

    // do our best to return something useful.
    return inputMethod.toString() + "-" + inputMethod.getLocale().toString();
}
 
Example #9
Source File: InputContext.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.InputContext#setCompositionEnabled(boolean)
 * @exception UnsupportedOperationException when input method is null
 */
public void setCompositionEnabled(boolean enable) {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    inputMethod.setCompositionEnabled(enable);
}
 
Example #10
Source File: InputContext.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.spi.InputMethodContext#enableClientWindowNotification
 */
synchronized void enableClientWindowNotification(InputMethod requester,
                                                 boolean enable) {
    // in case this request is not from the current input method,
    // store the request and handle it when this requesting input
    // method becomes the current one.
    if (requester != inputMethod) {
        if (perInputMethodState == null) {
            perInputMethodState = new HashMap<>(5);
        }
        perInputMethodState.put(requester, Boolean.valueOf(enable));
        return;
    }

    if (clientWindowNotificationEnabled != enable) {
        clientWindowLocation = null;
        clientWindowNotificationEnabled = enable;
    }
    if (clientWindowNotificationEnabled) {
        if (!addedClientWindowListeners()) {
            addClientWindowListeners();
        }
        if (clientWindowListened != null) {
            clientWindowLocation = null;
            notifyClientWindowChange(clientWindowListened);
        }
    } else {
        if (addedClientWindowListeners()) {
            removeClientWindowListeners();
        }
    }
}
 
Example #11
Source File: InputContext.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @return a string with information about the current input method.
 * @exception UnsupportedOperationException when input method is null
 */
public String getInputMethodInfo() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException("Null input method");
    }

    String inputMethodInfo = null;
    if (inputMethod instanceof InputMethodAdapter) {
        // returns the information about the host native input method.
        inputMethodInfo = ((InputMethodAdapter)inputMethod).
            getNativeInputMethodInfo();
    }

    // extracts the information from the InputMethodDescriptor
    // associated with the current java input method.
    if (inputMethodInfo == null && inputMethodLocator != null) {
        inputMethodInfo = inputMethodLocator.getDescriptor().
            getInputMethodDisplayName(getLocale(), SunToolkit.
                                      getStartupLocale());
    }

    if (inputMethodInfo != null && !inputMethodInfo.equals("")) {
        return inputMethodInfo;
    }

    // do our best to return something useful.
    return inputMethod.toString() + "-" + inputMethod.getLocale().toString();
}
 
Example #12
Source File: InputContext.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.InputContext#setCompositionEnabled(boolean)
 * @exception UnsupportedOperationException when input method is null
 */
public void setCompositionEnabled(boolean enable) {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    inputMethod.setCompositionEnabled(enable);
}
 
Example #13
Source File: InputContext.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private synchronized InputMethod getInputMethod() {
    if (inputMethod != null) {
        return inputMethod;
    }

    if (inputMethodCreationFailed) {
        return null;
    }

    inputMethod = getInputMethodInstance();
    return inputMethod;
}
 
Example #14
Source File: InputContext.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.InputContext#setCompositionEnabled(boolean)
 * @exception UnsupportedOperationException when input method is null
 */
public void setCompositionEnabled(boolean enable) {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    inputMethod.setCompositionEnabled(enable);
}
 
Example #15
Source File: InputContext.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.InputContext#reconvert
 * @since 1.3
 * @exception UnsupportedOperationException when input method is null
 */
public synchronized void reconvert() {
    InputMethod inputMethod = getInputMethod();
    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    inputMethod.reconvert();
}
 
Example #16
Source File: InputContext.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.InputContext#reconvert
 * @since 1.3
 * @exception UnsupportedOperationException when input method is null
 */
public synchronized void reconvert() {
    InputMethod inputMethod = getInputMethod();
    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    inputMethod.reconvert();
}
 
Example #17
Source File: InputContext.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.spi.InputMethodContext#enableClientWindowNotification
 */
synchronized void enableClientWindowNotification(InputMethod requester,
                                                 boolean enable) {
    // in case this request is not from the current input method,
    // store the request and handle it when this requesting input
    // method becomes the current one.
    if (requester != inputMethod) {
        if (perInputMethodState == null) {
            perInputMethodState = new HashMap<>(5);
        }
        perInputMethodState.put(requester, Boolean.valueOf(enable));
        return;
    }

    if (clientWindowNotificationEnabled != enable) {
        clientWindowLocation = null;
        clientWindowNotificationEnabled = enable;
    }
    if (clientWindowNotificationEnabled) {
        if (!addedClientWindowListeners()) {
            addClientWindowListeners();
        }
        if (clientWindowListened != null) {
            clientWindowLocation = null;
            notifyClientWindowChange(clientWindowListened);
        }
    } else {
        if (addedClientWindowListeners()) {
            removeClientWindowListeners();
        }
    }
}
 
Example #18
Source File: InputContext.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.spi.InputMethodContext#enableClientWindowNotification
 */
synchronized void enableClientWindowNotification(InputMethod requester,
                                                 boolean enable) {
    // in case this request is not from the current input method,
    // store the request and handle it when this requesting input
    // method becomes the current one.
    if (requester != inputMethod) {
        if (perInputMethodState == null) {
            perInputMethodState = new HashMap<>(5);
        }
        perInputMethodState.put(requester, Boolean.valueOf(enable));
        return;
    }

    if (clientWindowNotificationEnabled != enable) {
        clientWindowLocation = null;
        clientWindowNotificationEnabled = enable;
    }
    if (clientWindowNotificationEnabled) {
        if (!addedClientWindowListeners()) {
            addClientWindowListeners();
        }
        if (clientWindowListened != null) {
            clientWindowLocation = null;
            notifyClientWindowChange(clientWindowListened);
        }
    } else {
        if (addedClientWindowListeners()) {
            removeClientWindowListeners();
        }
    }
}
 
Example #19
Source File: InputContext.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.InputContext#setCompositionEnabled(boolean)
 * @exception UnsupportedOperationException when input method is null
 */
public void setCompositionEnabled(boolean enable) {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    inputMethod.setCompositionEnabled(enable);
}
 
Example #20
Source File: InputContext.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.InputContext#reconvert
 * @since 1.3
 * @exception UnsupportedOperationException when input method is null
 */
public synchronized void reconvert() {
    InputMethod inputMethod = getInputMethod();
    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    inputMethod.reconvert();
}
 
Example #21
Source File: InputContext.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.InputContext#setCompositionEnabled(boolean)
 * @exception UnsupportedOperationException when input method is null
 */
public void setCompositionEnabled(boolean enable) {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    inputMethod.setCompositionEnabled(enable);
}
 
Example #22
Source File: InputContext.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.InputContext#isCompositionEnabled
 * @exception UnsupportedOperationException when input method is null
 */
public boolean isCompositionEnabled() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    return inputMethod.isCompositionEnabled();
}
 
Example #23
Source File: InputContext.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private synchronized InputMethod getInputMethod() {
    if (inputMethod != null) {
        return inputMethod;
    }

    if (inputMethodCreationFailed) {
        return null;
    }

    inputMethod = getInputMethodInstance();
    return inputMethod;
}
 
Example #24
Source File: InputContext.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.spi.InputMethodContext#enableClientWindowNotification
 */
synchronized void enableClientWindowNotification(InputMethod requester,
                                                 boolean enable) {
    // in case this request is not from the current input method,
    // store the request and handle it when this requesting input
    // method becomes the current one.
    if (requester != inputMethod) {
        if (perInputMethodState == null) {
            perInputMethodState = new HashMap<>(5);
        }
        perInputMethodState.put(requester, Boolean.valueOf(enable));
        return;
    }

    if (clientWindowNotificationEnabled != enable) {
        clientWindowLocation = null;
        clientWindowNotificationEnabled = enable;
    }
    if (clientWindowNotificationEnabled) {
        if (!addedClientWindowListeners()) {
            addClientWindowListeners();
        }
        if (clientWindowListened != null) {
            clientWindowLocation = null;
            notifyClientWindowChange(clientWindowListened);
        }
    } else {
        if (addedClientWindowListeners()) {
            removeClientWindowListeners();
        }
    }
}
 
Example #25
Source File: InputContext.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private synchronized InputMethod getInputMethod() {
    if (inputMethod != null) {
        return inputMethod;
    }

    if (inputMethodCreationFailed) {
        return null;
    }

    inputMethod = getInputMethodInstance();
    return inputMethod;
}
 
Example #26
Source File: InputContext.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @return a string with information about the current input method.
 * @exception UnsupportedOperationException when input method is null
 */
public String getInputMethodInfo() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException("Null input method");
    }

    String inputMethodInfo = null;
    if (inputMethod instanceof InputMethodAdapter) {
        // returns the information about the host native input method.
        inputMethodInfo = ((InputMethodAdapter)inputMethod).
            getNativeInputMethodInfo();
    }

    // extracts the information from the InputMethodDescriptor
    // associated with the current java input method.
    if (inputMethodInfo == null && inputMethodLocator != null) {
        inputMethodInfo = inputMethodLocator.getDescriptor().
            getInputMethodDisplayName(getLocale(), SunToolkit.
                                      getStartupLocale());
    }

    if (inputMethodInfo != null && !inputMethodInfo.equals("")) {
        return inputMethodInfo;
    }

    // do our best to return something useful.
    return inputMethod.toString() + "-" + inputMethod.getLocale().toString();
}
 
Example #27
Source File: InputContext.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * @see java.awt.im.InputContext#reconvert
 * @since 1.3
 * @exception UnsupportedOperationException when input method is null
 */
public synchronized void reconvert() {
    InputMethod inputMethod = getInputMethod();
    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    inputMethod.reconvert();
}
 
Example #28
Source File: InputContext.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.InputContext#isCompositionEnabled
 * @exception UnsupportedOperationException when input method is null
 */
public boolean isCompositionEnabled() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    return inputMethod.isCompositionEnabled();
}
 
Example #29
Source File: InputContext.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * @see java.awt.im.InputContext#getInputMethodControlObject
 */
public synchronized Object getInputMethodControlObject() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod != null) {
        return inputMethod.getControlObject();
    } else {
        return null;
    }
}
 
Example #30
Source File: InputContext.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * @see java.awt.im.InputContext#isCompositionEnabled
 * @exception UnsupportedOperationException when input method is null
 */
public boolean isCompositionEnabled() {
    InputMethod inputMethod = getInputMethod();

    if (inputMethod == null) {
        throw new UnsupportedOperationException();
    }
    return inputMethod.isCompositionEnabled();
}