public void actionPerformed(final ActionEvent e) {
Container ancestor = desktop.getFocusCycleRootAncestor();
if (ancestor == null) {
return;
}
FocusTraversalPolicy policy = ancestor.getFocusTraversalPolicy();
if (!(policy instanceof SortingFocusTraversalPolicy)) {
return;
}
SortingFocusTraversalPolicy sortingPolicy = (SortingFocusTraversalPolicy)policy;
boolean implicitEnabled = sortingPolicy.getImplicitDownCycleTraversal();
sortingPolicy.setImplicitDownCycleTraversal(false);
Component result = null;
String action = (String)getValue(NAME);
if ("navigateNext".equals(action)) {
result = policy.getComponentAfter(ancestor, desktop);
} else if ("navigatePrevious".equals(action)) {
result = policy.getComponentBefore(ancestor, desktop);
}
sortingPolicy.setImplicitDownCycleTraversal(implicitEnabled);
if (result != null) {
result.requestFocus();
}
}
java类javax.swing.SortingFocusTraversalPolicy的实例源码
BasicDesktopPaneUI.java 文件源码
项目:cn1
阅读 22
收藏 0
点赞 0
评论 0
BasicDesktopPaneUI.java 文件源码
项目:freeVM
阅读 18
收藏 0
点赞 0
评论 0
public void actionPerformed(final ActionEvent e) {
Container ancestor = desktop.getFocusCycleRootAncestor();
if (ancestor == null) {
return;
}
FocusTraversalPolicy policy = ancestor.getFocusTraversalPolicy();
if (!(policy instanceof SortingFocusTraversalPolicy)) {
return;
}
SortingFocusTraversalPolicy sortingPolicy = (SortingFocusTraversalPolicy)policy;
boolean implicitEnabled = sortingPolicy.getImplicitDownCycleTraversal();
sortingPolicy.setImplicitDownCycleTraversal(false);
Component result = null;
String action = (String)getValue(NAME);
if ("navigateNext".equals(action)) {
result = policy.getComponentAfter(ancestor, desktop);
} else if ("navigatePrevious".equals(action)) {
result = policy.getComponentBefore(ancestor, desktop);
}
sortingPolicy.setImplicitDownCycleTraversal(implicitEnabled);
if (result != null) {
result.requestFocus();
}
}
BasicDesktopPaneUI.java 文件源码
项目:freeVM
阅读 21
收藏 0
点赞 0
评论 0
public void actionPerformed(final ActionEvent e) {
Container ancestor = desktop.getFocusCycleRootAncestor();
if (ancestor == null) {
return;
}
FocusTraversalPolicy policy = ancestor.getFocusTraversalPolicy();
if (!(policy instanceof SortingFocusTraversalPolicy)) {
return;
}
SortingFocusTraversalPolicy sortingPolicy = (SortingFocusTraversalPolicy)policy;
boolean implicitEnabled = sortingPolicy.getImplicitDownCycleTraversal();
sortingPolicy.setImplicitDownCycleTraversal(false);
Component result = null;
String action = (String)getValue(NAME);
if ("navigateNext".equals(action)) {
result = policy.getComponentAfter(ancestor, desktop);
} else if ("navigatePrevious".equals(action)) {
result = policy.getComponentBefore(ancestor, desktop);
}
sortingPolicy.setImplicitDownCycleTraversal(implicitEnabled);
if (result != null) {
result.requestFocus();
}
}