< prev index next >

src/java.desktop/share/classes/java/awt/Container.java

Print this page


   1 /*
   2  * Copyright (c) 1995, 2016, 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


3047         synchronized(getTreeLock()) {
3048             for (int i = 0; i < component.size(); i++) {
3049                 Component comp = component.get(i);
3050                 if (comp != null) {
3051                     comp.list(out, indent+1);
3052                 }
3053             }
3054         }
3055     }
3056 
3057     /**
3058      * Sets the focus traversal keys for a given traversal operation for this
3059      * Container.
3060      * <p>
3061      * The default values for a Container's focus traversal keys are
3062      * implementation-dependent. Sun recommends that all implementations for a
3063      * particular native platform use the same default values. The
3064      * recommendations for Windows and Unix are listed below. These
3065      * recommendations are used in the Sun AWT implementations.
3066      *
3067      * <table border=1 summary="Recommended default values for a Container's focus traversal keys">



3068      * <tr>
3069      *    <th>Identifier</th>
3070      *    <th>Meaning</th>
3071      *    <th>Default</th>
3072      * </tr>


3073      * <tr>
3074      *    <td>KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS</td>
3075      *    <td>Normal forward keyboard traversal</td>
3076      *    <td>TAB on KEY_PRESSED, CTRL-TAB on KEY_PRESSED</td>
3077      * </tr>
3078      * <tr>
3079      *    <td>KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS</td>
3080      *    <td>Normal reverse keyboard traversal</td>
3081      *    <td>SHIFT-TAB on KEY_PRESSED, CTRL-SHIFT-TAB on KEY_PRESSED</td>
3082      * </tr>
3083      * <tr>
3084      *    <td>KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS</td>
3085      *    <td>Go up one focus traversal cycle</td>
3086      *    <td>none</td>
3087      * </tr>
3088      * <tr>
3089      *    <td>KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS<td>
3090      *    <td>Go down one focus traversal cycle</td>
3091      *    <td>none</td>
3092      * </tr>

3093      * </table>
3094      *
3095      * To disable a traversal key, use an empty Set; Collections.EMPTY_SET is
3096      * recommended.
3097      * <p>
3098      * Using the AWTKeyStroke API, client code can specify on which of two
3099      * specific KeyEvents, KEY_PRESSED or KEY_RELEASED, the focus traversal
3100      * operation will occur. Regardless of which KeyEvent is specified,
3101      * however, all KeyEvents related to the focus traversal key, including the
3102      * associated KEY_TYPED event, will be consumed, and will not be dispatched
3103      * to any Container. It is a runtime error to specify a KEY_TYPED event as
3104      * mapping to a focus traversal operation, or to map the same event to
3105      * multiple default focus traversal operations.
3106      * <p>
3107      * If a value of null is specified for the Set, this Container inherits the
3108      * Set from its parent. If all ancestors of this Container have null
3109      * specified for the Set, then the current KeyboardFocusManager's default
3110      * Set is used.
3111      * <p>
3112      * This method may throw a {@code ClassCastException} if any {@code Object}


   1 /*
   2  * Copyright (c) 1995, 2017, 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


3047         synchronized(getTreeLock()) {
3048             for (int i = 0; i < component.size(); i++) {
3049                 Component comp = component.get(i);
3050                 if (comp != null) {
3051                     comp.list(out, indent+1);
3052                 }
3053             }
3054         }
3055     }
3056 
3057     /**
3058      * Sets the focus traversal keys for a given traversal operation for this
3059      * Container.
3060      * <p>
3061      * The default values for a Container's focus traversal keys are
3062      * implementation-dependent. Sun recommends that all implementations for a
3063      * particular native platform use the same default values. The
3064      * recommendations for Windows and Unix are listed below. These
3065      * recommendations are used in the Sun AWT implementations.
3066      *
3067      * <table class="striped">
3068      * <caption>Recommended default values for a Container's focus traversal
3069      * keys</caption>
3070      * <thead>
3071      * <tr>
3072      *    <th>Identifier</th>
3073      *    <th>Meaning</th>
3074      *    <th>Default</th>
3075      * </tr>
3076      * </thead>
3077      * <tbody>
3078      * <tr>
3079      *    <td>KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS</td>
3080      *    <td>Normal forward keyboard traversal</td>
3081      *    <td>TAB on KEY_PRESSED, CTRL-TAB on KEY_PRESSED</td>
3082      * </tr>
3083      * <tr>
3084      *    <td>KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS</td>
3085      *    <td>Normal reverse keyboard traversal</td>
3086      *    <td>SHIFT-TAB on KEY_PRESSED, CTRL-SHIFT-TAB on KEY_PRESSED</td>
3087      * </tr>
3088      * <tr>
3089      *    <td>KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS</td>
3090      *    <td>Go up one focus traversal cycle</td>
3091      *    <td>none</td>
3092      * </tr>
3093      * <tr>
3094      *    <td>KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS</td>
3095      *    <td>Go down one focus traversal cycle</td>
3096      *    <td>none</td>
3097      * </tr>
3098      * </tbody>
3099      * </table>
3100      *
3101      * To disable a traversal key, use an empty Set; Collections.EMPTY_SET is
3102      * recommended.
3103      * <p>
3104      * Using the AWTKeyStroke API, client code can specify on which of two
3105      * specific KeyEvents, KEY_PRESSED or KEY_RELEASED, the focus traversal
3106      * operation will occur. Regardless of which KeyEvent is specified,
3107      * however, all KeyEvents related to the focus traversal key, including the
3108      * associated KEY_TYPED event, will be consumed, and will not be dispatched
3109      * to any Container. It is a runtime error to specify a KEY_TYPED event as
3110      * mapping to a focus traversal operation, or to map the same event to
3111      * multiple default focus traversal operations.
3112      * <p>
3113      * If a value of null is specified for the Set, this Container inherits the
3114      * Set from its parent. If all ancestors of this Container have null
3115      * specified for the Set, then the current KeyboardFocusManager's default
3116      * Set is used.
3117      * <p>
3118      * This method may throw a {@code ClassCastException} if any {@code Object}


< prev index next >