< prev index next >

## src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTextUI.java

Print this page

     494      * key bindings as necessary.
     495      */
     496     void updateFocusAcceleratorBinding(boolean changed) {
     497         char accelerator = editor.getFocusAccelerator();
     498
     499         if (changed || accelerator != '\0') {
     500             InputMap km = SwingUtilities.getUIInputMap
     501                         (editor, JComponent.WHEN_IN_FOCUSED_WINDOW);
     502
     503             if (km == null && accelerator != '\0') {
     504                 km = new ComponentInputMapUIResource(editor);
     505                 SwingUtilities.replaceUIInputMap(editor, JComponent.
     506                                                  WHEN_IN_FOCUSED_WINDOW, km);
     507                 ActionMap am = getActionMap();
     508                 SwingUtilities.replaceUIActionMap(editor, am);
     509             }
     510             if (km != null) {
     511                 km.clear();
     512                 if (accelerator != '\0') {
     513                     km.put(KeyStroke.getKeyStroke(accelerator, BasicLookAndFeel.getFocusAcceleratorKeyMask()), "requestFocus");

     514                 }
     515             }
     516         }
     517     }
     518
     519
     520     /**
     521      * Invoked when editable property is changed.
     522      *
     523      * removing 'TAB' and 'SHIFT-TAB' from traversalKeysSet in case
     524      * editor is editable
     525      * adding 'TAB' and 'SHIFT-TAB' to traversalKeysSet in case
     526      * editor is non editable
     527      */
     528     @SuppressWarnings("deprecation")
     529     void updateFocusTraversalKeys() {
     530         /*
     531          * Fix for 4514331 Non-editable JTextArea and similar
     532          * should allow Tab to keyboard - accessibility
     533          */
     494      * key bindings as necessary.
     495      */
     496     void updateFocusAcceleratorBinding(boolean changed) {
     497         char accelerator = editor.getFocusAccelerator();
     498
     499         if (changed || accelerator != '\0') {
     500             InputMap km = SwingUtilities.getUIInputMap
     501                         (editor, JComponent.WHEN_IN_FOCUSED_WINDOW);
     502
     503             if (km == null && accelerator != '\0') {
     504                 km = new ComponentInputMapUIResource(editor);
     505                 SwingUtilities.replaceUIInputMap(editor, JComponent.
     506                                                  WHEN_IN_FOCUSED_WINDOW, km);
     507                 ActionMap am = getActionMap();
     508                 SwingUtilities.replaceUIActionMap(editor, am);
     509             }
     510             if (km != null) {
     511                 km.clear();
     512                 if (accelerator != '\0') {
     513                     km.put(KeyStroke.getKeyStroke(accelerator, BasicLookAndFeel.getFocusAcceleratorKeyMask()), "requestFocus");
     514                     km.put(KeyStroke.getKeyStroke(accelerator,
     515                             BasicLookAndFeel.getFocusAcceleratorKeyMask() |
     516                             InputEvent.ALT_GRAPH_DOWN_MASK), "requestFocus");
     517                 }
     518             }
     519         }
     520     }
     521
     522
     523     /**
     524      * Invoked when editable property is changed.
     525      *
     526      * removing 'TAB' and 'SHIFT-TAB' from traversalKeysSet in case
     527      * editor is editable
     528      * adding 'TAB' and 'SHIFT-TAB' to traversalKeysSet in case
     529      * editor is non editable
     530      */
     531     @SuppressWarnings("deprecation")
     532     void updateFocusTraversalKeys() {
     533         /*
     534          * Fix for 4514331 Non-editable JTextArea and similar
     535          * should allow Tab to keyboard - accessibility
     536          */

< prev index next >