< prev index next >

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

Print this page


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


1022 
1023         firePropertyChange("defaultFocusTraversalPolicy", oldPolicy,
1024                            defaultPolicy);
1025     }
1026 
1027     /**
1028      * Sets the default focus traversal keys for a given traversal operation.
1029      * This traversal key {@code Set} will be in effect on all
1030      * {@code Window}s that have no such {@code Set} of
1031      * their own explicitly defined. This {@code Set} will also be
1032      * inherited, recursively, by any child {@code Component} of
1033      * those {@code Windows} that has
1034      * no such {@code Set} of its own explicitly defined.
1035      * <p>
1036      * The default values for the default focus traversal keys are
1037      * implementation-dependent. Sun recommends that all implementations for a
1038      * particular native platform use the same default values. The
1039      * recommendations for Windows and Unix are listed below. These
1040      * recommendations are used in the Sun AWT implementations.
1041      *
1042      * <table border=1 summary="Recommended default values for focus traversal keys">



1043      * <tr>
1044      *    <th>Identifier</th>
1045      *    <th>Meaning</th>
1046      *    <th>Default</th>
1047      * </tr>


1048      * <tr>
1049      *    <td>{@code KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS}</td>
1050      *    <td>Normal forward keyboard traversal</td>
1051      *    <td>{@code TAB} on {@code KEY_PRESSED},
1052      *        {@code CTRL-TAB} on {@code KEY_PRESSED}</td>
1053      * </tr>
1054      * <tr>
1055      *    <td>{@code KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS}</td>
1056      *    <td>Normal reverse keyboard traversal</td>
1057      *    <td>{@code SHIFT-TAB} on {@code KEY_PRESSED},
1058      *        {@code CTRL-SHIFT-TAB} on {@code KEY_PRESSED}</td>
1059      * </tr>
1060      * <tr>
1061      *    <td>{@code KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS}</td>
1062      *    <td>Go up one focus traversal cycle</td>
1063      *    <td>none</td>
1064      * </tr>
1065      * <tr>
1066      *    <td>{@code KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS}</td>
1067      *    <td>Go down one focus traversal cycle</td>
1068      *    <td>none</td>
1069      * </tr>

1070      * </table>
1071      *
1072      * To disable a traversal key, use an empty {@code Set};
1073      * {@code Collections.EMPTY_SET} is recommended.
1074      * <p>
1075      * Using the {@code AWTKeyStroke} API, client code can
1076      * specify on which of two
1077      * specific {@code KeyEvent}s, {@code KEY_PRESSED} or
1078      * {@code KEY_RELEASED}, the focus traversal operation will
1079      * occur. Regardless of which {@code KeyEvent} is specified,
1080      * however, all {@code KeyEvent}s related to the focus
1081      * traversal key, including the associated {@code KEY_TYPED}
1082      * event, will be consumed, and will not be dispatched
1083      * to any {@code Component}. It is a runtime error to
1084      * specify a {@code KEY_TYPED} event as
1085      * mapping to a focus traversal operation, or to map the same event to
1086      * multiple default focus traversal operations.
1087      * <p>
1088      * This method may throw a {@code ClassCastException} if any {@code Object}
1089      * in {@code keystrokes} is not an {@code AWTKeyStroke}.


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


1022 
1023         firePropertyChange("defaultFocusTraversalPolicy", oldPolicy,
1024                            defaultPolicy);
1025     }
1026 
1027     /**
1028      * Sets the default focus traversal keys for a given traversal operation.
1029      * This traversal key {@code Set} will be in effect on all
1030      * {@code Window}s that have no such {@code Set} of
1031      * their own explicitly defined. This {@code Set} will also be
1032      * inherited, recursively, by any child {@code Component} of
1033      * those {@code Windows} that has
1034      * no such {@code Set} of its own explicitly defined.
1035      * <p>
1036      * The default values for the default focus traversal keys are
1037      * implementation-dependent. Sun recommends that all implementations for a
1038      * particular native platform use the same default values. The
1039      * recommendations for Windows and Unix are listed below. These
1040      * recommendations are used in the Sun AWT implementations.
1041      *
1042      * <table class="striped">
1043      * <caption style="display:none">Recommended default values for focus
1044      * traversal keys</caption>
1045      * <thead>
1046      * <tr>
1047      *    <th>Identifier</th>
1048      *    <th>Meaning</th>
1049      *    <th>Default</th>
1050      * </tr>
1051      * </thead>
1052      * <tbody>
1053      * <tr>
1054      *    <td>{@code KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS}</td>
1055      *    <td>Normal forward keyboard traversal</td>
1056      *    <td>{@code TAB} on {@code KEY_PRESSED},
1057      *        {@code CTRL-TAB} on {@code KEY_PRESSED}</td>
1058      * </tr>
1059      * <tr>
1060      *    <td>{@code KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS}</td>
1061      *    <td>Normal reverse keyboard traversal</td>
1062      *    <td>{@code SHIFT-TAB} on {@code KEY_PRESSED},
1063      *        {@code CTRL-SHIFT-TAB} on {@code KEY_PRESSED}</td>
1064      * </tr>
1065      * <tr>
1066      *    <td>{@code KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS}</td>
1067      *    <td>Go up one focus traversal cycle</td>
1068      *    <td>none</td>
1069      * </tr>
1070      * <tr>
1071      *    <td>{@code KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS}</td>
1072      *    <td>Go down one focus traversal cycle</td>
1073      *    <td>none</td>
1074      * </tr>
1075      * </tbody>
1076      * </table>
1077      *
1078      * To disable a traversal key, use an empty {@code Set};
1079      * {@code Collections.EMPTY_SET} is recommended.
1080      * <p>
1081      * Using the {@code AWTKeyStroke} API, client code can
1082      * specify on which of two
1083      * specific {@code KeyEvent}s, {@code KEY_PRESSED} or
1084      * {@code KEY_RELEASED}, the focus traversal operation will
1085      * occur. Regardless of which {@code KeyEvent} is specified,
1086      * however, all {@code KeyEvent}s related to the focus
1087      * traversal key, including the associated {@code KEY_TYPED}
1088      * event, will be consumed, and will not be dispatched
1089      * to any {@code Component}. It is a runtime error to
1090      * specify a {@code KEY_TYPED} event as
1091      * mapping to a focus traversal operation, or to map the same event to
1092      * multiple default focus traversal operations.
1093      * <p>
1094      * This method may throw a {@code ClassCastException} if any {@code Object}
1095      * in {@code keystrokes} is not an {@code AWTKeyStroke}.


< prev index next >