< prev index next >
src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java
Print this page
@@ -1095,10 +1095,11 @@
// The following code is used for support of automatic showing of the touch
// keyboard for text components and is accessed only from EDT.
///////////////////////////////////////////////////////////////////////////
private volatile Component compOnTouchDownEvent;
private volatile Component compOnMousePressedEvent;
+ private volatile Component compTouchKbrdWasShownFor;
@Override
public void showOrHideTouchKeyboard(Component comp, AWTEvent e) {
if ((comp == null) || (e == null) ||
(!(comp instanceof TextComponent) &&
@@ -1123,22 +1124,30 @@
} else if (me.getID() == MouseEvent.MOUSE_RELEASED) {
if (AWTAccessor.getMouseEventAccessor()
.isCausedByTouchEvent(me)) {
if (compOnTouchDownEvent == comp) {
showTouchKeyboard(true);
+ compTouchKbrdWasShownFor = comp;
}
compOnTouchDownEvent = null;
} else {
if (compOnMousePressedEvent == comp) {
showTouchKeyboard(false);
+ compTouchKbrdWasShownFor = comp;
}
compOnMousePressedEvent = null;
}
}
} else if (e instanceof FocusEvent) {
- if (e.getID() == FocusEvent.FOCUS_LOST) {
- hideTouchKeyboard();
+ FocusEvent fe = (FocusEvent)e;
+ if (fe.getID() == FocusEvent.FOCUS_LOST) {
+ // Do not hide the touch keyboard, if it has just been shown for
+ // a component which gains focus.
+ if (fe.getOppositeComponent() != compTouchKbrdWasShownFor) {
+ hideTouchKeyboard();
+ }
+ compTouchKbrdWasShownFor = null;
}
}
}
private native void showTouchKeyboard(boolean causedByTouchEvent);
< prev index next >