提交 80cfc946 编写于 作者: D dcherepanov

6581899: JTextField & JTextArea - Poor performance with JRE 1.5.0_08

Summary: acquire the first|last components only when the key is a traversal key
Reviewed-by: ant
上级 4092eb41
......@@ -257,21 +257,27 @@ public abstract class EmbeddedFrame extends Frame
Set toTest;
Component currentFocused = e.getComponent();
Component last = getFocusTraversalPolicy().getLastComponent(this);
toTest = getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
if (toTest.contains(stroke) && (currentFocused == last || last == null)) {
if (traverseOut(FORWARD)) {
e.consume();
return true;
if (toTest.contains(stroke)) {
// 6581899: performance improvement for SortingFocusTraversalPolicy
Component last = getFocusTraversalPolicy().getLastComponent(this);
if (currentFocused == last || last == null) {
if (traverseOut(FORWARD)) {
e.consume();
return true;
}
}
}
Component first = getFocusTraversalPolicy().getFirstComponent(this);
toTest = getFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
if (toTest.contains(stroke) && (currentFocused == first || first == null)) {
if (traverseOut(BACKWARD)) {
e.consume();
return true;
if (toTest.contains(stroke)) {
// 6581899: performance improvement for SortingFocusTraversalPolicy
Component first = getFocusTraversalPolicy().getFirstComponent(this);
if (currentFocused == first || first == null) {
if (traverseOut(BACKWARD)) {
e.consume();
return true;
}
}
}
return false;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册