当前位置: 首页>>代码示例>>Java>>正文


Java InputMethodDescriptor类代码示例

本文整理汇总了Java中java.awt.im.spi.InputMethodDescriptor的典型用法代码示例。如果您正苦于以下问题:Java InputMethodDescriptor类的具体用法?Java InputMethodDescriptor怎么用?Java InputMethodDescriptor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


InputMethodDescriptor类属于java.awt.im.spi包,在下文中一共展示了InputMethodDescriptor类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ExecutableInputMethodManager

import java.awt.im.spi.InputMethodDescriptor; //导入依赖的package包/类
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();
    }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:ExecutableInputMethodManager.java

示例2: show

import java.awt.im.spi.InputMethodDescriptor; //导入依赖的package包/类
private void show(Component origin, InputMethodContext imc) {
    imContext = imc;
    
    for (int i = 0; i < getItemCount(); i++) {
        MenuItem item = getItem(i);
        if (!(item instanceof IMSubmenu)) {
            // skip all non-menu elements, such as separators
            continue;
        }
        IMSubmenu subMenu = (IMSubmenu) item;
        InputMethodDescriptor desc = subMenu.getDesc();
        if (desc == null) {
            continue;
        }
        if (desc.hasDynamicLocaleList()) {                    
            subMenu.removeAll();
            subMenu.addLocales();
        }
        subMenu.checkItems();
        i++;
    }
    show(origin, 50, 50);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:24,代码来源:IMManager.java

示例3: initializeInputMethodLocatorList

import java.awt.im.spi.InputMethodDescriptor; //导入依赖的package包/类
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;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:ExecutableInputMethodManager.java

示例4: InputMethodLocator

import java.awt.im.spi.InputMethodDescriptor; //导入依赖的package包/类
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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:InputMethodLocator.java

示例5: addOneInputMethodToMenu

import java.awt.im.spi.InputMethodDescriptor; //导入依赖的package包/类
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);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:39,代码来源:InputMethodPopupMenu.java

示例6: getInputMethodAdapterDescriptor

import java.awt.im.spi.InputMethodDescriptor; //导入依赖的package包/类
@Override
public InputMethodDescriptor getInputMethodAdapterDescriptor() {
    if (sInputMethodDescriptor == null)
        sInputMethodDescriptor = new CInputMethodDescriptor();

    return sInputMethodDescriptor;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:LWCToolkit.java

示例7: initializeInputMethodLocatorList

import java.awt.im.spi.InputMethodDescriptor; //导入依赖的package包/类
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;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:ExecutableInputMethodManager.java


注:本文中的java.awt.im.spi.InputMethodDescriptor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。