mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 19:44:41 +02:00
6581899: JTextField & JTextArea - Poor performance with JRE 1.5.0_08
Acquire the first|last components only when the key is a traversal key Reviewed-by: ant
This commit is contained in:
parent
3a96c0f73d
commit
86ac930e55
1 changed files with 16 additions and 10 deletions
|
@ -257,23 +257,29 @@ public abstract class EmbeddedFrame extends Frame
|
||||||
Set toTest;
|
Set toTest;
|
||||||
Component currentFocused = e.getComponent();
|
Component currentFocused = e.getComponent();
|
||||||
|
|
||||||
Component last = getFocusTraversalPolicy().getLastComponent(this);
|
|
||||||
toTest = getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
|
toTest = getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
|
||||||
if (toTest.contains(stroke) && (currentFocused == last || last == null)) {
|
if (toTest.contains(stroke)) {
|
||||||
|
// 6581899: performance improvement for SortingFocusTraversalPolicy
|
||||||
|
Component last = getFocusTraversalPolicy().getLastComponent(this);
|
||||||
|
if (currentFocused == last || last == null) {
|
||||||
if (traverseOut(FORWARD)) {
|
if (traverseOut(FORWARD)) {
|
||||||
e.consume();
|
e.consume();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component first = getFocusTraversalPolicy().getFirstComponent(this);
|
|
||||||
toTest = getFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
|
toTest = getFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
|
||||||
if (toTest.contains(stroke) && (currentFocused == first || first == null)) {
|
if (toTest.contains(stroke)) {
|
||||||
|
// 6581899: performance improvement for SortingFocusTraversalPolicy
|
||||||
|
Component first = getFocusTraversalPolicy().getFirstComponent(this);
|
||||||
|
if (currentFocused == first || first == null) {
|
||||||
if (traverseOut(BACKWARD)) {
|
if (traverseOut(BACKWARD)) {
|
||||||
e.consume();
|
e.consume();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue