1 /*
2 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
51 * Please see
52 * <a href="https://docs.oracle.com/javase/tutorial/uiswing/misc/focus.html">
53 * How to Use the Focus Subsystem</a>,
54 * a section in <em>The Java Tutorial</em>, and the
55 * <a href="../../java/awt/doc-files/FocusSpec.html">Focus Specification</a>
56 * for more information.
57 *
58 * @author David Mendenhall
59 *
60 * @see Container#setFocusTraversalPolicy
61 * @see Container#getFocusTraversalPolicy
62 * @see Container#setFocusCycleRoot
63 * @see Container#isFocusCycleRoot
64 * @see Container#setFocusTraversalPolicyProvider
65 * @see Container#isFocusTraversalPolicyProvider
66 * @see KeyboardFocusManager#setDefaultFocusTraversalPolicy
67 * @see KeyboardFocusManager#getDefaultFocusTraversalPolicy
68 * @since 1.4
69 */
70 public abstract class FocusTraversalPolicy {
71
72 /**
73 * Returns the Component that should receive the focus after aComponent.
74 * aContainer must be a focus cycle root of aComponent or a focus traversal
75 * policy provider.
76 *
77 * @param aContainer a focus cycle root of aComponent or focus traversal
78 * policy provider
79 * @param aComponent a (possibly indirect) child of aContainer, or
80 * aContainer itself
81 * @return the Component that should receive the focus after aComponent, or
82 * null if no suitable Component can be found
83 * @throws IllegalArgumentException if aContainer is not a focus cycle
84 * root of aComponent or a focus traversal policy provider, or if
85 * either aContainer or aComponent is null
86 */
87 public abstract Component getComponentAfter(Container aContainer,
88 Component aComponent);
89
90 /**
|
1 /*
2 * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
51 * Please see
52 * <a href="https://docs.oracle.com/javase/tutorial/uiswing/misc/focus.html">
53 * How to Use the Focus Subsystem</a>,
54 * a section in <em>The Java Tutorial</em>, and the
55 * <a href="../../java/awt/doc-files/FocusSpec.html">Focus Specification</a>
56 * for more information.
57 *
58 * @author David Mendenhall
59 *
60 * @see Container#setFocusTraversalPolicy
61 * @see Container#getFocusTraversalPolicy
62 * @see Container#setFocusCycleRoot
63 * @see Container#isFocusCycleRoot
64 * @see Container#setFocusTraversalPolicyProvider
65 * @see Container#isFocusTraversalPolicyProvider
66 * @see KeyboardFocusManager#setDefaultFocusTraversalPolicy
67 * @see KeyboardFocusManager#getDefaultFocusTraversalPolicy
68 * @since 1.4
69 */
70 public abstract class FocusTraversalPolicy {
71
72 /**
73 * Constructs a {@code FocusTraversalPolicy}.
74 */
75 protected FocusTraversalPolicy() {}
76
77 /**
78 * Returns the Component that should receive the focus after aComponent.
79 * aContainer must be a focus cycle root of aComponent or a focus traversal
80 * policy provider.
81 *
82 * @param aContainer a focus cycle root of aComponent or focus traversal
83 * policy provider
84 * @param aComponent a (possibly indirect) child of aContainer, or
85 * aContainer itself
86 * @return the Component that should receive the focus after aComponent, or
87 * null if no suitable Component can be found
88 * @throws IllegalArgumentException if aContainer is not a focus cycle
89 * root of aComponent or a focus traversal policy provider, or if
90 * either aContainer or aComponent is null
91 */
92 public abstract Component getComponentAfter(Container aContainer,
93 Component aComponent);
94
95 /**
|