use of java.awt.event.InputMethodEvent in project jdk8u_jdk by JetBrains.
the class InputContext method dispatchEvent.
/**
* @see java.awt.im.InputContext#dispatchEvent
*/
@SuppressWarnings("fallthrough")
public void dispatchEvent(AWTEvent event) {
if (event instanceof InputMethodEvent) {
return;
}
// This is a workaround. Should be removed after 4452384 is fixed.
if (event instanceof FocusEvent) {
Component opposite = ((FocusEvent) event).getOppositeComponent();
if ((opposite != null) && (getComponentWindow(opposite) instanceof InputMethodWindow) && (opposite.getInputContext() == this)) {
return;
}
}
InputMethod inputMethod = getInputMethod();
int id = event.getID();
switch(id) {
case FocusEvent.FOCUS_GAINED:
focusGained((Component) event.getSource());
break;
case FocusEvent.FOCUS_LOST:
focusLost((Component) event.getSource(), ((FocusEvent) event).isTemporary());
break;
case KeyEvent.KEY_PRESSED:
if (checkInputMethodSelectionKey((KeyEvent) event)) {
// pop up the input method selection menu
InputMethodManager.getInstance().notifyChangeRequestByHotKey((Component) event.getSource());
break;
}
default:
if ((inputMethod != null) && (event instanceof InputEvent)) {
inputMethod.dispatchEvent(event);
}
}
}
use of java.awt.event.InputMethodEvent in project jdk8u_jdk by JetBrains.
the class InputMethodContext method dispatchInputMethodEvent.
// implements java.awt.im.spi.InputMethodContext.dispatchInputMethodEvent
public void dispatchInputMethodEvent(int id, AttributedCharacterIterator text, int committedCharacterCount, TextHitInfo caret, TextHitInfo visiblePosition) {
// We need to record the client component as the source so
// that we have correct information if we later have to break up this
// event into key events.
Component source;
source = getClientComponent();
if (source != null) {
InputMethodEvent event = new InputMethodEvent(source, id, text, committedCharacterCount, caret, visiblePosition);
if (haveActiveClient() && !useBelowTheSpotInput()) {
source.dispatchEvent(event);
} else {
getCompositionAreaHandler(true).processInputMethodEvent(event);
}
}
}
Aggregations