Java 类javax.swing.SortingFocusTraversalPolicy 实例源码

项目:cn1    文件:BasicDesktopPaneUI.java   
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();
    }
}
项目:freeVM    文件:BasicDesktopPaneUI.java   
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();
    }
}
项目:freeVM    文件:BasicDesktopPaneUI.java   
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();
    }
}