src/share/classes/javax/swing/JComponent.java

Print this page




4132             }
4133         } else if (propertyName == "focusTraversalKeysBackward") {
4134             if (!getFlag(FOCUS_TRAVERSAL_KEYS_BACKWARD_SET)) {
4135                 super.setFocusTraversalKeys(KeyboardFocusManager.
4136                                             BACKWARD_TRAVERSAL_KEYS,
4137                                             (Set<AWTKeyStroke>)value);
4138             }
4139         } else {
4140             throw new IllegalArgumentException("property \""+
4141                                                propertyName+ "\" cannot be set using this method");
4142         }
4143     }
4144 
4145 
4146     /**
4147      * Sets the focus traversal keys for a given traversal operation for this
4148      * Component.
4149      * Refer to
4150      * {@link java.awt.Component#setFocusTraversalKeys}
4151      * for a complete description of this method.




4152      *
4153      * @param id one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
4154      *        KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, or
4155      *        KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS
4156      * @param keystrokes the Set of AWTKeyStroke for the specified operation
4157      * @see java.awt.KeyboardFocusManager#FORWARD_TRAVERSAL_KEYS
4158      * @see java.awt.KeyboardFocusManager#BACKWARD_TRAVERSAL_KEYS
4159      * @see java.awt.KeyboardFocusManager#UP_CYCLE_TRAVERSAL_KEYS
4160      * @throws IllegalArgumentException if id is not one of
4161      *         KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
4162      *         KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, or
4163      *         KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or if keystrokes
4164      *         contains null, or if any Object in keystrokes is not an
4165      *         AWTKeyStroke, or if any keystroke represents a KEY_TYPED event,
4166      *         or if any keystroke already maps to another focus traversal
4167      *         operation for this Component
4168      * @since 1.5
4169      * @beaninfo
4170      *       bound: true
4171      */
4172     public void
4173         setFocusTraversalKeys(int id, Set<? extends AWTKeyStroke> keystrokes)
4174     {
4175         if (id == KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS) {
4176             setFlag(FOCUS_TRAVERSAL_KEYS_FORWARD_SET,true);
4177         } else if (id == KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS) {
4178             setFlag(FOCUS_TRAVERSAL_KEYS_BACKWARD_SET,true);
4179         }
4180         super.setFocusTraversalKeys(id,keystrokes);
4181     }
4182 
4183     /* --- Transitional java.awt.Component Support ---
4184      * The methods and fields in this section will migrate to
4185      * java.awt.Component in the next JDK release.




4132             }
4133         } else if (propertyName == "focusTraversalKeysBackward") {
4134             if (!getFlag(FOCUS_TRAVERSAL_KEYS_BACKWARD_SET)) {
4135                 super.setFocusTraversalKeys(KeyboardFocusManager.
4136                                             BACKWARD_TRAVERSAL_KEYS,
4137                                             (Set<AWTKeyStroke>)value);
4138             }
4139         } else {
4140             throw new IllegalArgumentException("property \""+
4141                                                propertyName+ "\" cannot be set using this method");
4142         }
4143     }
4144 
4145 
4146     /**
4147      * Sets the focus traversal keys for a given traversal operation for this
4148      * Component.
4149      * Refer to
4150      * {@link java.awt.Component#setFocusTraversalKeys}
4151      * for a complete description of this method.
4152      * <p>
4153      * This method may throw a {@code ClassCastException} if any 
4154      * {@code Object} in {@code keystrokes} is not an 
4155      * {@code AWTKeyStroke}.
4156      *
4157      * @param id one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
4158      *        KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, or
4159      *        KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS
4160      * @param keystrokes the Set of AWTKeyStroke for the specified operation
4161      * @see java.awt.KeyboardFocusManager#FORWARD_TRAVERSAL_KEYS
4162      * @see java.awt.KeyboardFocusManager#BACKWARD_TRAVERSAL_KEYS
4163      * @see java.awt.KeyboardFocusManager#UP_CYCLE_TRAVERSAL_KEYS
4164      * @throws IllegalArgumentException if id is not one of
4165      *         KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,
4166      *         KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, or
4167      *         KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or if keystrokes
4168      *         contains null, or if any keystroke represents a KEY_TYPED event,

4169      *         or if any keystroke already maps to another focus traversal
4170      *         operation for this Component
4171      * @since 1.5
4172      * @beaninfo
4173      *       bound: true
4174      */
4175     public void
4176         setFocusTraversalKeys(int id, Set<? extends AWTKeyStroke> keystrokes)
4177     {
4178         if (id == KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS) {
4179             setFlag(FOCUS_TRAVERSAL_KEYS_FORWARD_SET,true);
4180         } else if (id == KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS) {
4181             setFlag(FOCUS_TRAVERSAL_KEYS_BACKWARD_SET,true);
4182         }
4183         super.setFocusTraversalKeys(id,keystrokes);
4184     }
4185 
4186     /* --- Transitional java.awt.Component Support ---
4187      * The methods and fields in this section will migrate to
4188      * java.awt.Component in the next JDK release.