FileDocCategorySizeDatePackage
DefaultFocusManager.javaAPI DocJava SE 5 API4761Fri Aug 26 14:57:54 BST 2005javax.swing

DefaultFocusManager

public class DefaultFocusManager extends FocusManager
This class has been obsoleted by the 1.4 focus APIs. While client code may still use this class, developers are strongly encouraged to use java.awt.KeyboardFocusManager and java.awt.DefaultKeyboardFocusManager instead.

Please see How to Use the Focus Subsystem, a section in The Java Tutorial, and the Focus Specification for more information.

version
1.29, 12/19/03
author
Arnaud Weber
author
David Mendenhall

Fields Summary
final FocusTraversalPolicy
gluePolicy
private final FocusTraversalPolicy
layoutPolicy
private final LayoutComparator
comparator
Constructors Summary
public DefaultFocusManager()


      
	setDefaultFocusTraversalPolicy(gluePolicy);
    
Methods Summary
public booleancompareTabOrder(java.awt.Component a, java.awt.Component b)

	return (comparator.compare(a, b) < 0);
    
public java.awt.ComponentgetComponentAfter(java.awt.Container aContainer, java.awt.Component aComponent)

	Container root = (aContainer.isFocusCycleRoot())
	    ? aContainer
	    : aContainer.getFocusCycleRootAncestor();

	// Support for mixed 1.4/pre-1.4 focus APIs. If a particular root's
	// traversal policy is non-legacy, then honor it.
	if (root != null) {
	    FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
	    if (policy != gluePolicy) {
		return policy.getComponentAfter(root, aComponent);
	    }

	    comparator.setComponentOrientation(root.getComponentOrientation());
	    return layoutPolicy.getComponentAfter(root, aComponent);
	}

	return null;
    
public java.awt.ComponentgetComponentBefore(java.awt.Container aContainer, java.awt.Component aComponent)

	Container root = (aContainer.isFocusCycleRoot())
	    ? aContainer
	    : aContainer.getFocusCycleRootAncestor();

	// Support for mixed 1.4/pre-1.4 focus APIs. If a particular root's
	// traversal policy is non-legacy, then honor it.
	if (root != null) {
	    FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
	    if (policy != gluePolicy) {
		return policy.getComponentBefore(root, aComponent);
	    }

	    comparator.setComponentOrientation(root.getComponentOrientation());
	    return layoutPolicy.getComponentBefore(root, aComponent);
	}

	return null;
    
public java.awt.ComponentgetFirstComponent(java.awt.Container aContainer)

	Container root = (aContainer.isFocusCycleRoot())
	    ? aContainer
	    : aContainer.getFocusCycleRootAncestor();

	// Support for mixed 1.4/pre-1.4 focus APIs. If a particular root's
	// traversal policy is non-legacy, then honor it.
	if (root != null) {
	    FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
	    if (policy != gluePolicy) {
		return policy.getFirstComponent(root);
	    }

	    comparator.setComponentOrientation(root.getComponentOrientation());
	    return layoutPolicy.getFirstComponent(root);
	}

	return null;
    
public java.awt.ComponentgetLastComponent(java.awt.Container aContainer)

	Container root = (aContainer.isFocusCycleRoot())
	    ? aContainer
	    : aContainer.getFocusCycleRootAncestor();

	// Support for mixed 1.4/pre-1.4 focus APIs. If a particular root's
	// traversal policy is non-legacy, then honor it.
	if (root != null) {
	    FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
	    if (policy != gluePolicy) {
		return policy.getLastComponent(root);
	    }

	    comparator.setComponentOrientation(root.getComponentOrientation());
	    return layoutPolicy.getLastComponent(root);
	}

	return null;