本文整理汇总了Java中java.awt.im.spi.InputMethod类的典型用法代码示例。如果您正苦于以下问题:Java InputMethod类的具体用法?Java InputMethod怎么用?Java InputMethod使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InputMethod类属于java.awt.im.spi包,在下文中一共展示了InputMethod类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: activateIM
import java.awt.im.spi.InputMethod; //导入依赖的package包/类
private void activateIM(InputMethod im) {
Component c;
im.activate();
if ((nativeIM != null) && (im != nativeIM)) {
// when Java IM is active
// native input method editor must be
// explicitly disabled
nativeIM.disableIME();
}
IMManager.setLastActiveIMC(this);
c = getClient();
if (c != null) {
c.getInputMethodRequests();
}
}
示例2: selectInputMethod
import java.awt.im.spi.InputMethod; //导入依赖的package包/类
@Override
public boolean selectInputMethod(Locale locale) {
if ((inputMethod != null) && inputMethod.setLocale(locale)) {
return true;
}
// first
// take last user-selected IM for locale
InputMethod newIM = localeIM.get(locale);
// if not found search through IM descriptors
// and take already created instance if exists
// or create, store new IM instance in descriptor->instance map
if (newIM == null) {
try {
newIM = getIMInstance(IMManager.getIMDescriptors().iterator(),
locale);
} catch (Exception e) {
// ignore exceptions - just return false
}
}
return switchToIM(locale, newIM);
}
示例3: enableClientWindowNotification
import java.awt.im.spi.InputMethod; //导入依赖的package包/类
public void enableClientWindowNotification(InputMethod inputMethod,
boolean enable) {
if (enable) {
notifyIM.add(inputMethod);
if (client != null) {
notifyClientWindowChange(IMManager.getWindow(client).getBounds());
} else {
pendingClientNotify = true;
}
} else {
notifyIM.remove(inputMethod);
}
}
示例4: reconvert
import java.awt.im.spi.InputMethod; //导入依赖的package包/类
/**
* @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();
}
示例5: getInputMethodControlObject
import java.awt.im.spi.InputMethod; //导入依赖的package包/类
/**
* @see java.awt.im.InputContext#getInputMethodControlObject
*/
public synchronized Object getInputMethodControlObject() {
InputMethod inputMethod = getInputMethod();
if (inputMethod != null) {
return inputMethod.getControlObject();
} else {
return null;
}
}
示例6: setCompositionEnabled
import java.awt.im.spi.InputMethod; //导入依赖的package包/类
/**
* @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);
}
示例7: isCompositionEnabled
import java.awt.im.spi.InputMethod; //导入依赖的package包/类
/**
* @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();
}
示例8: getInputMethodInfo
import java.awt.im.spi.InputMethod; //导入依赖的package包/类
/**
* @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();
}
示例9: getInputMethod
import java.awt.im.spi.InputMethod; //导入依赖的package包/类
private synchronized InputMethod getInputMethod() {
if (inputMethod != null) {
return inputMethod;
}
if (inputMethodCreationFailed) {
return null;
}
inputMethod = getInputMethodInstance();
return inputMethod;
}
示例10: enableClientWindowNotification
import java.awt.im.spi.InputMethod; //导入依赖的package包/类
/**
* @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();
}
}
}