本文整理汇总了Java中java.awt.Component.getInputMethodRequests方法的典型用法代码示例。如果您正苦于以下问题:Java Component.getInputMethodRequests方法的具体用法?Java Component.getInputMethodRequests怎么用?Java Component.getInputMethodRequests使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Component
的用法示例。
在下文中一共展示了Component.getInputMethodRequests方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCompositionArea
import java.awt.Component; //导入方法依赖的package包/类
/**
* Creates the composition area.
*/
private void createCompositionArea() {
synchronized(compositionAreaLock) {
compositionArea = new CompositionArea();
if (compositionAreaOwner != null) {
compositionArea.setHandlerInfo(compositionAreaOwner, inputMethodContext);
}
// If the client component is an active client using below-the-spot style, then
// make the composition window undecorated without a title bar.
Component client = clientComponent.get();
if(client != null){
InputMethodRequests req = client.getInputMethodRequests();
if (req != null && inputMethodContext.useBelowTheSpotInput()) {
setCompositionAreaUndecorated(true);
}
}
}
}
示例2: getClientInputMethodRequests
import java.awt.Component; //导入方法依赖的package包/类
/**
* Returns the input method request handler of the client component.
* When using the composition window for an active client (below-the-spot
* input), input method requests that do not relate to the display of
* the composed text are forwarded to the client component.
*/
InputMethodRequests getClientInputMethodRequests() {
Component client = clientComponent.get();
if (client != null) {
return client.getInputMethodRequests();
}
return null;
}
示例3: dispatchCommittedText
import java.awt.Component; //导入方法依赖的package包/类
/**
* Dispatches committed text to a client component.
* Called by composition window.
*
* @param client The component that the text should get dispatched to.
* @param text The iterator providing access to the committed
* (and possible composed) text.
* @param committedCharacterCount The number of committed characters in the text.
*/
synchronized void dispatchCommittedText(Component client,
AttributedCharacterIterator text,
int committedCharacterCount) {
// note that the client is not always the current client component -
// some host input method adapters may dispatch input method events
// through the Java event queue, and we may have switched clients while
// the event was in the queue.
if (committedCharacterCount == 0
|| text.getEndIndex() <= text.getBeginIndex()) {
return;
}
long time = System.currentTimeMillis();
dispatchingCommittedText = true;
try {
InputMethodRequests req = client.getInputMethodRequests();
if (req != null) {
// active client -> send text as InputMethodEvent
int beginIndex = text.getBeginIndex();
AttributedCharacterIterator toBeCommitted =
(new AttributedString(text, beginIndex, beginIndex + committedCharacterCount)).getIterator();
InputMethodEvent inputEvent = new InputMethodEvent(
client,
InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
toBeCommitted,
committedCharacterCount,
null, null);
client.dispatchEvent(inputEvent);
} else {
// passive client -> send text as KeyEvents
char keyChar = text.first();
while (committedCharacterCount-- > 0 && keyChar != CharacterIterator.DONE) {
KeyEvent keyEvent = new KeyEvent(client, KeyEvent.KEY_TYPED,
time, 0, KeyEvent.VK_UNDEFINED, keyChar);
client.dispatchEvent(keyEvent);
keyChar = text.next();
}
}
} finally {
dispatchingCommittedText = false;
}
}
示例4: haveActiveClient
import java.awt.Component; //导入方法依赖的package包/类
private boolean haveActiveClient() {
Component client = getClientComponent();
return client != null
&& client.getInputMethodRequests() != null;
}