DefaultFocusTraversalPolicy.java revision 2362
2362N/A * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 2362N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A * or visit www.oracle.com if you need additional information or have any 0N/A * A FocusTraversalPolicy that determines traversal order based on the order 0N/A * of child Components in a Container. From a particular focus cycle root, the 0N/A * policy makes a pre-order traversal of the Component hierarchy, and traverses 0N/A * a Container's children according to the ordering of the array returned by 0N/A * <code>Container.getComponents()</code>. Portions of the hierarchy that are 0N/A * not visible and displayable will not be searched. 0N/A * If client code has explicitly set the focusability of a Component by either 0N/A * overriding <code>Component.isFocusTraversable()</code> or 0N/A * <code>Component.isFocusable()</code>, or by calling 0N/A * <code>Component.setFocusable()</code>, then a DefaultFocusTraversalPolicy 0N/A * behaves exactly like a ContainerOrderFocusTraversalPolicy. If, however, the 0N/A * Component is relying on default focusability, then a 0N/A * DefaultFocusTraversalPolicy will reject all Components with non-focusable 0N/A * peers. This is the default FocusTraversalPolicy for all AWT Containers. 0N/A * The focusability of a peer is implementation-dependent. Sun recommends that 0N/A * all implementations for a particular native platform construct peers with 0N/A * the same focusability. The recommendations for Windows and Unix are that 0N/A * Canvases, Labels, Panels, Scrollbars, ScrollPanes, Windows, and lightweight 0N/A * Components have non-focusable peers, and all other Components have focusable 0N/A * peers. These recommendations are used in the Sun AWT implementations. Note 2500N/A * that the focusability of a Component's peer is different from, and does not 2500N/A * impact, the focusability of the Component itself. 2500N/A * How to Use the Focus Subsystem</a>, * a section in <em>The Java Tutorial</em>, and the * @author David Mendenhall * @see Container#getComponents * @see Component#isFocusable * @see Component#setFocusable * Determines whether a Component is an acceptable choice as the new * focus owner. The Component must be visible, displayable, and enabled * to be accepted. If client code has explicitly set the focusability * of the Component by either overriding * <code>Component.isFocusTraversable()</code> or * <code>Component.isFocusable()</code>, or by calling * <code>Component.setFocusable()</code>, then the Component will be * accepted if and only if it is focusable. If, however, the Component is * relying on default focusability, then all Canvases, Labels, Panels, * Scrollbars, ScrollPanes, Windows, and lightweight Components will be * @param aComponent the Component whose fitness as a focus owner is to * @return <code>true</code> if aComponent meets the above requirements; * <code>false</code> otherwise // Verify that the Component is recursively enabled. Disabling a // heavyweight Container disables its children, whereas disabling // a lightweight Container does not.