1 7 package java.awt; 8 9 import java.awt.peer.ComponentPeer; 10 11 12 53 public class DefaultFocusTraversalPolicy 54 extends ContainerOrderFocusTraversalPolicy 55 { 56 57 75 protected boolean accept(Component aComponent) { 76 if (!(aComponent.isVisible() && aComponent.isDisplayable() && 77 aComponent.isEnabled())) 78 { 79 return false; 80 } 81 82 if (!(aComponent instanceof Window )) { 86 for (Container enableTest = aComponent.getParent(); 87 enableTest != null; 88 enableTest = enableTest.getParent()) 89 { 90 if (!(enableTest.isEnabled() || enableTest.isLightweight())) { 91 return false; 92 } 93 if (enableTest instanceof Window ) { 94 break; 95 } 96 } 97 } 98 99 boolean focusable = aComponent.isFocusable(); 100 if (aComponent.isFocusTraversableOverridden()) { 101 return focusable; 102 } 103 104 ComponentPeer peer = aComponent.getPeer(); 105 return (peer != null && peer.isFocusable()); 106 } 107 } 108 | Popular Tags |