类java.awt.im.spi.InputMethodDescriptor源码实例Demo

下面列出了怎么用java.awt.im.spi.InputMethodDescriptor的API类实例代码及写法,或者点击链接到github查看源代码。

ExecutableInputMethodManager() {

        // set up host adapter locator
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        try {
            if (toolkit instanceof InputMethodSupport) {
                InputMethodDescriptor hostAdapterDescriptor =
                    ((InputMethodSupport)toolkit)
                    .getInputMethodAdapterDescriptor();
                if (hostAdapterDescriptor != null) {
                    hostAdapterLocator = new InputMethodLocator(hostAdapterDescriptor, null, null);
                }
            }
        } catch (AWTException e) {
            // if we can't get a descriptor, we'll just have to do without native input methods
        }

        javaInputMethodLocatorList = new Vector<InputMethodLocator>();
        initializeInputMethodLocatorList();
    }
 
源代码2 项目: jdk8u60   文件: ExecutableInputMethodManager.java
ExecutableInputMethodManager() {

        // set up host adapter locator
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        try {
            if (toolkit instanceof InputMethodSupport) {
                InputMethodDescriptor hostAdapterDescriptor =
                    ((InputMethodSupport)toolkit)
                    .getInputMethodAdapterDescriptor();
                if (hostAdapterDescriptor != null) {
                    hostAdapterLocator = new InputMethodLocator(hostAdapterDescriptor, null, null);
                }
            }
        } catch (AWTException e) {
            // if we can't get a descriptor, we'll just have to do without native input methods
        }

        javaInputMethodLocatorList = new Vector<InputMethodLocator>();
        initializeInputMethodLocatorList();
    }
 
ExecutableInputMethodManager() {

        // set up host adapter locator
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        try {
            if (toolkit instanceof InputMethodSupport) {
                InputMethodDescriptor hostAdapterDescriptor =
                    ((InputMethodSupport)toolkit)
                    .getInputMethodAdapterDescriptor();
                if (hostAdapterDescriptor != null) {
                    hostAdapterLocator = new InputMethodLocator(hostAdapterDescriptor, null, null);
                }
            }
        } catch (AWTException e) {
            // if we can't get a descriptor, we'll just have to do without native input methods
        }

        javaInputMethodLocatorList = new Vector<InputMethodLocator>();
        initializeInputMethodLocatorList();
    }
 
源代码4 项目: jdk8u-jdk   文件: ExecutableInputMethodManager.java
ExecutableInputMethodManager() {

        // set up host adapter locator
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        try {
            if (toolkit instanceof InputMethodSupport) {
                InputMethodDescriptor hostAdapterDescriptor =
                    ((InputMethodSupport)toolkit)
                    .getInputMethodAdapterDescriptor();
                if (hostAdapterDescriptor != null) {
                    hostAdapterLocator = new InputMethodLocator(hostAdapterDescriptor, null, null);
                }
            }
        } catch (AWTException e) {
            // if we can't get a descriptor, we'll just have to do without native input methods
        }

        javaInputMethodLocatorList = new Vector<InputMethodLocator>();
        initializeInputMethodLocatorList();
    }
 
private void initializeInputMethodLocatorList() {
    synchronized (javaInputMethodLocatorList) {
        javaInputMethodLocatorList.clear();
        try {
            AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                public Object run() {
                    for (InputMethodDescriptor descriptor :
                        ServiceLoader.loadInstalled(InputMethodDescriptor.class)) {
                        ClassLoader cl = descriptor.getClass().getClassLoader();
                        javaInputMethodLocatorList.add(new InputMethodLocator(descriptor, cl, null));
                    }
                    return null;
                }
            });
        }  catch (PrivilegedActionException e) {
            e.printStackTrace();
        }
        javaInputMethodCount = javaInputMethodLocatorList.size();
    }

    if (hasMultipleInputMethods()) {
        // initialize preferences
        if (userRoot == null) {
            userRoot = getUserRoot();
        }
    } else {
        // indicate to clients not to offer the menu
        triggerMenuString = null;
    }
}
 
源代码6 项目: jdk8u_jdk   文件: InputMethodLocator.java
InputMethodLocator(InputMethodDescriptor descriptor, ClassLoader loader, Locale locale) {
    if (descriptor == null) {
        throw new NullPointerException("descriptor can't be null");
    }
    this.descriptor = descriptor;
    this.loader = loader;
    this.locale = locale;
}
 
源代码7 项目: dragonwell8_jdk   文件: InputMethodLocator.java
InputMethodLocator(InputMethodDescriptor descriptor, ClassLoader loader, Locale locale) {
    if (descriptor == null) {
        throw new NullPointerException("descriptor can't be null");
    }
    this.descriptor = descriptor;
    this.loader = loader;
    this.locale = locale;
}
 
源代码8 项目: hottub   文件: ExecutableInputMethodManager.java
private void initializeInputMethodLocatorList() {
    synchronized (javaInputMethodLocatorList) {
        javaInputMethodLocatorList.clear();
        try {
            AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                public Object run() {
                    for (InputMethodDescriptor descriptor :
                        ServiceLoader.loadInstalled(InputMethodDescriptor.class)) {
                        ClassLoader cl = descriptor.getClass().getClassLoader();
                        javaInputMethodLocatorList.add(new InputMethodLocator(descriptor, cl, null));
                    }
                    return null;
                }
            });
        }  catch (PrivilegedActionException e) {
            e.printStackTrace();
        }
        javaInputMethodCount = javaInputMethodLocatorList.size();
    }

    if (hasMultipleInputMethods()) {
        // initialize preferences
        if (userRoot == null) {
            userRoot = getUserRoot();
        }
    } else {
        // indicate to clients not to offer the menu
        triggerMenuString = null;
    }
}
 
源代码9 项目: TencentKona-8   文件: InputMethodLocator.java
InputMethodLocator(InputMethodDescriptor descriptor, ClassLoader loader, Locale locale) {
    if (descriptor == null) {
        throw new NullPointerException("descriptor can't be null");
    }
    this.descriptor = descriptor;
    this.loader = loader;
    this.locale = locale;
}
 
源代码10 项目: jdk8u-dev-jdk   文件: InputMethodLocator.java
InputMethodLocator(InputMethodDescriptor descriptor, ClassLoader loader, Locale locale) {
    if (descriptor == null) {
        throw new NullPointerException("descriptor can't be null");
    }
    this.descriptor = descriptor;
    this.loader = loader;
    this.locale = locale;
}
 
源代码11 项目: hottub   文件: LWCToolkit.java
@Override
public InputMethodDescriptor getInputMethodAdapterDescriptor() {
    if (sInputMethodDescriptor == null)
        sInputMethodDescriptor = new CInputMethodDescriptor();

    return sInputMethodDescriptor;
}
 
源代码12 项目: jdk8u60   文件: InputMethodPopupMenu.java
void addOneInputMethodToMenu(InputMethodLocator locator, String currentSelection) {
    InputMethodDescriptor descriptor = locator.getDescriptor();
    String label = descriptor.getInputMethodDisplayName(null, Locale.getDefault());
    String command = locator.getActionCommandString();
    Locale[] locales = null;
    int localeCount;
    try {
        locales = descriptor.getAvailableLocales();
        localeCount = locales.length;
    } catch (AWTException e) {
        // ??? should have better error handling -
        // tell user what happened, then remove this input method from the list.
        // For the time being, just show it disabled.
        localeCount = 0;
    }
    if (localeCount == 0) {
        // could be IIIMP adapter which has lost its connection
        addMenuItem(label, null, currentSelection);
    } else if (localeCount == 1) {
        if (descriptor.hasDynamicLocaleList()) {
            // try to make sure that what the user sees and what
            // we eventually select is consistent even if the locale
            // list changes in the meantime
            label = descriptor.getInputMethodDisplayName(locales[0], Locale.getDefault());
            command = locator.deriveLocator(locales[0]).getActionCommandString();
        }
        addMenuItem(label, command, currentSelection);
    } else {
        Object submenu = createSubmenu(label);
        add(submenu);
        for (int j = 0; j < localeCount; j++) {
            Locale locale = locales[j];
            String subLabel = getLocaleName(locale);
            String subCommand = locator.deriveLocator(locale).getActionCommandString();
            addMenuItem(submenu, subLabel, subCommand, currentSelection);
        }
    }
}
 
源代码13 项目: jdk8u60   文件: LWCToolkit.java
@Override
public InputMethodDescriptor getInputMethodAdapterDescriptor() {
    if (sInputMethodDescriptor == null)
        sInputMethodDescriptor = new CInputMethodDescriptor();

    return sInputMethodDescriptor;
}
 
private void initializeInputMethodLocatorList() {
    synchronized (javaInputMethodLocatorList) {
        javaInputMethodLocatorList.clear();
        try {
            AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                public Object run() {
                    for (InputMethodDescriptor descriptor :
                        ServiceLoader.loadInstalled(InputMethodDescriptor.class)) {
                        ClassLoader cl = descriptor.getClass().getClassLoader();
                        javaInputMethodLocatorList.add(new InputMethodLocator(descriptor, cl, null));
                    }
                    return null;
                }
            });
        }  catch (PrivilegedActionException e) {
            e.printStackTrace();
        }
        javaInputMethodCount = javaInputMethodLocatorList.size();
    }

    if (hasMultipleInputMethods()) {
        // initialize preferences
        if (userRoot == null) {
            userRoot = getUserRoot();
        }
    } else {
        // indicate to clients not to offer the menu
        triggerMenuString = null;
    }
}
 
源代码15 项目: openjdk-8-source   文件: InputMethodPopupMenu.java
void addOneInputMethodToMenu(InputMethodLocator locator, String currentSelection) {
    InputMethodDescriptor descriptor = locator.getDescriptor();
    String label = descriptor.getInputMethodDisplayName(null, Locale.getDefault());
    String command = locator.getActionCommandString();
    Locale[] locales = null;
    int localeCount;
    try {
        locales = descriptor.getAvailableLocales();
        localeCount = locales.length;
    } catch (AWTException e) {
        // ??? should have better error handling -
        // tell user what happened, then remove this input method from the list.
        // For the time being, just show it disabled.
        localeCount = 0;
    }
    if (localeCount == 0) {
        // could be IIIMP adapter which has lost its connection
        addMenuItem(label, null, currentSelection);
    } else if (localeCount == 1) {
        if (descriptor.hasDynamicLocaleList()) {
            // try to make sure that what the user sees and what
            // we eventually select is consistent even if the locale
            // list changes in the meantime
            label = descriptor.getInputMethodDisplayName(locales[0], Locale.getDefault());
            command = locator.deriveLocator(locales[0]).getActionCommandString();
        }
        addMenuItem(label, command, currentSelection);
    } else {
        Object submenu = createSubmenu(label);
        add(submenu);
        for (int j = 0; j < localeCount; j++) {
            Locale locale = locales[j];
            String subLabel = getLocaleName(locale);
            String subCommand = locator.deriveLocator(locale).getActionCommandString();
            addMenuItem(submenu, subLabel, subCommand, currentSelection);
        }
    }
}
 
private void initializeInputMethodLocatorList() {
    synchronized (javaInputMethodLocatorList) {
        javaInputMethodLocatorList.clear();
        try {
            AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                public Object run() {
                    for (InputMethodDescriptor descriptor :
                        ServiceLoader.loadInstalled(InputMethodDescriptor.class)) {
                        ClassLoader cl = descriptor.getClass().getClassLoader();
                        javaInputMethodLocatorList.add(new InputMethodLocator(descriptor, cl, null));
                    }
                    return null;
                }
            });
        }  catch (PrivilegedActionException e) {
            e.printStackTrace();
        }
        javaInputMethodCount = javaInputMethodLocatorList.size();
    }

    if (hasMultipleInputMethods()) {
        // initialize preferences
        if (userRoot == null) {
            userRoot = getUserRoot();
        }
    } else {
        // indicate to clients not to offer the menu
        triggerMenuString = null;
    }
}
 
源代码17 项目: openjdk-jdk8u-backup   文件: InputMethodLocator.java
InputMethodLocator(InputMethodDescriptor descriptor, ClassLoader loader, Locale locale) {
    if (descriptor == null) {
        throw new NullPointerException("descriptor can't be null");
    }
    this.descriptor = descriptor;
    this.loader = loader;
    this.locale = locale;
}
 
源代码18 项目: jdk8u-jdk   文件: InputMethodPopupMenu.java
void addOneInputMethodToMenu(InputMethodLocator locator, String currentSelection) {
    InputMethodDescriptor descriptor = locator.getDescriptor();
    String label = descriptor.getInputMethodDisplayName(null, Locale.getDefault());
    String command = locator.getActionCommandString();
    Locale[] locales = null;
    int localeCount;
    try {
        locales = descriptor.getAvailableLocales();
        localeCount = locales.length;
    } catch (AWTException e) {
        // ??? should have better error handling -
        // tell user what happened, then remove this input method from the list.
        // For the time being, just show it disabled.
        localeCount = 0;
    }
    if (localeCount == 0) {
        // could be IIIMP adapter which has lost its connection
        addMenuItem(label, null, currentSelection);
    } else if (localeCount == 1) {
        if (descriptor.hasDynamicLocaleList()) {
            // try to make sure that what the user sees and what
            // we eventually select is consistent even if the locale
            // list changes in the meantime
            label = descriptor.getInputMethodDisplayName(locales[0], Locale.getDefault());
            command = locator.deriveLocator(locales[0]).getActionCommandString();
        }
        addMenuItem(label, command, currentSelection);
    } else {
        Object submenu = createSubmenu(label);
        add(submenu);
        for (int j = 0; j < localeCount; j++) {
            Locale locale = locales[j];
            String subLabel = getLocaleName(locale);
            String subCommand = locator.deriveLocator(locale).getActionCommandString();
            addMenuItem(submenu, subLabel, subCommand, currentSelection);
        }
    }
}
 
void addOneInputMethodToMenu(InputMethodLocator locator, String currentSelection) {
    InputMethodDescriptor descriptor = locator.getDescriptor();
    String label = descriptor.getInputMethodDisplayName(null, Locale.getDefault());
    String command = locator.getActionCommandString();
    Locale[] locales = null;
    int localeCount;
    try {
        locales = descriptor.getAvailableLocales();
        localeCount = locales.length;
    } catch (AWTException e) {
        // ??? should have better error handling -
        // tell user what happened, then remove this input method from the list.
        // For the time being, just show it disabled.
        localeCount = 0;
    }
    if (localeCount == 0) {
        // could be IIIMP adapter which has lost its connection
        addMenuItem(label, null, currentSelection);
    } else if (localeCount == 1) {
        if (descriptor.hasDynamicLocaleList()) {
            // try to make sure that what the user sees and what
            // we eventually select is consistent even if the locale
            // list changes in the meantime
            label = descriptor.getInputMethodDisplayName(locales[0], Locale.getDefault());
            command = locator.deriveLocator(locales[0]).getActionCommandString();
        }
        addMenuItem(label, command, currentSelection);
    } else {
        Object submenu = createSubmenu(label);
        add(submenu);
        for (int j = 0; j < localeCount; j++) {
            Locale locale = locales[j];
            String subLabel = getLocaleName(locale);
            String subCommand = locator.deriveLocator(locale).getActionCommandString();
            addMenuItem(submenu, subLabel, subCommand, currentSelection);
        }
    }
}
 
源代码20 项目: jdk8u-jdk   文件: LWCToolkit.java
@Override
public InputMethodDescriptor getInputMethodAdapterDescriptor() {
    if (sInputMethodDescriptor == null)
        sInputMethodDescriptor = new CInputMethodDescriptor();

    return sInputMethodDescriptor;
}
 
源代码21 项目: jdk8u-jdk   文件: InputMethodPopupMenu.java
void addOneInputMethodToMenu(InputMethodLocator locator, String currentSelection) {
    InputMethodDescriptor descriptor = locator.getDescriptor();
    String label = descriptor.getInputMethodDisplayName(null, Locale.getDefault());
    String command = locator.getActionCommandString();
    Locale[] locales = null;
    int localeCount;
    try {
        locales = descriptor.getAvailableLocales();
        localeCount = locales.length;
    } catch (AWTException e) {
        // ??? should have better error handling -
        // tell user what happened, then remove this input method from the list.
        // For the time being, just show it disabled.
        localeCount = 0;
    }
    if (localeCount == 0) {
        // could be IIIMP adapter which has lost its connection
        addMenuItem(label, null, currentSelection);
    } else if (localeCount == 1) {
        if (descriptor.hasDynamicLocaleList()) {
            // try to make sure that what the user sees and what
            // we eventually select is consistent even if the locale
            // list changes in the meantime
            label = descriptor.getInputMethodDisplayName(locales[0], Locale.getDefault());
            command = locator.deriveLocator(locales[0]).getActionCommandString();
        }
        addMenuItem(label, command, currentSelection);
    } else {
        Object submenu = createSubmenu(label);
        add(submenu);
        for (int j = 0; j < localeCount; j++) {
            Locale locale = locales[j];
            String subLabel = getLocaleName(locale);
            String subCommand = locator.deriveLocator(locale).getActionCommandString();
            addMenuItem(submenu, subLabel, subCommand, currentSelection);
        }
    }
}
 
源代码22 项目: jdk8u_jdk   文件: ExecutableInputMethodManager.java
private void initializeInputMethodLocatorList() {
    synchronized (javaInputMethodLocatorList) {
        javaInputMethodLocatorList.clear();
        try {
            AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                public Object run() {
                    for (InputMethodDescriptor descriptor :
                        ServiceLoader.loadInstalled(InputMethodDescriptor.class)) {
                        ClassLoader cl = descriptor.getClass().getClassLoader();
                        javaInputMethodLocatorList.add(new InputMethodLocator(descriptor, cl, null));
                    }
                    return null;
                }
            });
        }  catch (PrivilegedActionException e) {
            e.printStackTrace();
        }
        javaInputMethodCount = javaInputMethodLocatorList.size();
    }

    if (hasMultipleInputMethods()) {
        // initialize preferences
        if (userRoot == null) {
            userRoot = getUserRoot();
        }
    } else {
        // indicate to clients not to offer the menu
        triggerMenuString = null;
    }
}
 
源代码23 项目: Bytecoder   文件: InputMethodPopupMenu.java
void addOneInputMethodToMenu(InputMethodLocator locator, String currentSelection) {
    InputMethodDescriptor descriptor = locator.getDescriptor();
    String label = descriptor.getInputMethodDisplayName(null, Locale.getDefault());
    String command = locator.getActionCommandString();
    Locale[] locales = null;
    int localeCount;
    try {
        locales = descriptor.getAvailableLocales();
        localeCount = locales.length;
    } catch (AWTException e) {
        // ??? should have better error handling -
        // tell user what happened, then remove this input method from the list.
        // For the time being, just show it disabled.
        localeCount = 0;
    }
    if (localeCount == 0) {
        // could be IIIMP adapter which has lost its connection
        addMenuItem(label, null, currentSelection);
    } else if (localeCount == 1) {
        if (descriptor.hasDynamicLocaleList()) {
            // try to make sure that what the user sees and what
            // we eventually select is consistent even if the locale
            // list changes in the meantime
            label = descriptor.getInputMethodDisplayName(locales[0], Locale.getDefault());
            command = locator.deriveLocator(locales[0]).getActionCommandString();
        }
        addMenuItem(label, command, currentSelection);
    } else {
        Object submenu = createSubmenu(label);
        add(submenu);
        for (int j = 0; j < localeCount; j++) {
            Locale locale = locales[j];
            String subLabel = getLocaleName(locale);
            String subCommand = locator.deriveLocator(locale).getActionCommandString();
            addMenuItem(submenu, subLabel, subCommand, currentSelection);
        }
    }
}
 
源代码24 项目: jdk8u-jdk   文件: ExecutableInputMethodManager.java
private void initializeInputMethodLocatorList() {
    synchronized (javaInputMethodLocatorList) {
        javaInputMethodLocatorList.clear();
        try {
            AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                public Object run() {
                    for (InputMethodDescriptor descriptor :
                        ServiceLoader.loadInstalled(InputMethodDescriptor.class)) {
                        ClassLoader cl = descriptor.getClass().getClassLoader();
                        javaInputMethodLocatorList.add(new InputMethodLocator(descriptor, cl, null));
                    }
                    return null;
                }
            });
        }  catch (PrivilegedActionException e) {
            e.printStackTrace();
        }
        javaInputMethodCount = javaInputMethodLocatorList.size();
    }

    if (hasMultipleInputMethods()) {
        // initialize preferences
        if (userRoot == null) {
            userRoot = getUserRoot();
        }
    } else {
        // indicate to clients not to offer the menu
        triggerMenuString = null;
    }
}
 
private void initializeInputMethodLocatorList() {
    synchronized (javaInputMethodLocatorList) {
        javaInputMethodLocatorList.clear();
        try {
            AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                public Object run() {
                    for (InputMethodDescriptor descriptor :
                        ServiceLoader.load(InputMethodDescriptor.class,
                                           ClassLoader.getSystemClassLoader())) {
                        ClassLoader cl = descriptor.getClass().getClassLoader();
                        javaInputMethodLocatorList.add(new InputMethodLocator(descriptor, cl, null));
                    }
                    return null;
                }
            });
        }  catch (PrivilegedActionException e) {
            e.printStackTrace();
        }
        javaInputMethodCount = javaInputMethodLocatorList.size();
    }

    if (hasMultipleInputMethods()) {
        // initialize preferences
        if (userRoot == null) {
            userRoot = getUserRoot();
        }
    } else {
        // indicate to clients not to offer the menu
        triggerMenuString = null;
    }
}
 
源代码26 项目: openjdk-jdk9   文件: InputMethodLocator.java
InputMethodLocator(InputMethodDescriptor descriptor, ClassLoader loader, Locale locale) {
    if (descriptor == null) {
        throw new NullPointerException("descriptor can't be null");
    }
    this.descriptor = descriptor;
    this.loader = loader;
    this.locale = locale;
}
 
源代码27 项目: jdk8u-jdk   文件: ExecutableInputMethodManager.java
private void initializeInputMethodLocatorList() {
    synchronized (javaInputMethodLocatorList) {
        javaInputMethodLocatorList.clear();
        try {
            AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                public Object run() {
                    for (InputMethodDescriptor descriptor :
                        ServiceLoader.loadInstalled(InputMethodDescriptor.class)) {
                        ClassLoader cl = descriptor.getClass().getClassLoader();
                        javaInputMethodLocatorList.add(new InputMethodLocator(descriptor, cl, null));
                    }
                    return null;
                }
            });
        }  catch (PrivilegedActionException e) {
            e.printStackTrace();
        }
        javaInputMethodCount = javaInputMethodLocatorList.size();
    }

    if (hasMultipleInputMethods()) {
        // initialize preferences
        if (userRoot == null) {
            userRoot = getUserRoot();
        }
    } else {
        // indicate to clients not to offer the menu
        triggerMenuString = null;
    }
}
 
源代码28 项目: jdk8u-jdk   文件: InputMethodLocator.java
InputMethodLocator(InputMethodDescriptor descriptor, ClassLoader loader, Locale locale) {
    if (descriptor == null) {
        throw new NullPointerException("descriptor can't be null");
    }
    this.descriptor = descriptor;
    this.loader = loader;
    this.locale = locale;
}
 
源代码29 项目: jdk8u_jdk   文件: WToolkit.java
/**
 * Returns a new input method adapter descriptor for native input methods.
 */
@Override
public InputMethodDescriptor getInputMethodAdapterDescriptor() {
    return new WInputMethodDescriptor();
}
 
源代码30 项目: hottub   文件: WToolkit.java
/**
 * Returns a new input method adapter descriptor for native input methods.
 */
@Override
public InputMethodDescriptor getInputMethodAdapterDescriptor() {
    return new WInputMethodDescriptor();
}
 
 类所在包
 同包方法