< prev index next >

src/java.desktop/share/classes/javax/swing/plaf/basic/BasicButtonListener.java

Print this page




 105                                            "Button.actionMap");
 106 
 107         InputMap km = getInputMap(JComponent.WHEN_FOCUSED, c);
 108 
 109         SwingUtilities.replaceUIInputMap(c, JComponent.WHEN_FOCUSED, km);
 110     }
 111 
 112     /**
 113      * Unregister default key actions.
 114      *
 115      * @param c a component
 116      */
 117     public void uninstallKeyboardActions(JComponent c) {
 118         SwingUtilities.replaceUIInputMap(c, JComponent.
 119                                          WHEN_IN_FOCUSED_WINDOW, null);
 120         SwingUtilities.replaceUIInputMap(c, JComponent.WHEN_FOCUSED, null);
 121         SwingUtilities.replaceUIActionMap(c, null);
 122     }
 123 
 124     /**
 125      * Returns the InputMap for condition <code>condition</code>. Called as
 126      * part of <code>installKeyboardActions</code>.
 127      */
 128     InputMap getInputMap(int condition, JComponent c) {
 129         if (condition == JComponent.WHEN_FOCUSED) {
 130             BasicButtonUI ui = (BasicButtonUI)BasicLookAndFeel.getUIOfType(
 131                          ((AbstractButton)c).getUI(), BasicButtonUI.class);
 132             if (ui != null) {
 133                 return (InputMap)DefaultLookup.get(
 134                              c, ui, ui.getPropertyPrefix() + "focusInputMap");
 135             }
 136         }
 137         return null;
 138     }
 139 
 140     /**
 141      * Resets the binding for the mnemonic in the WHEN_IN_FOCUSED_WINDOW
 142      * UI InputMap.
 143      */
 144     void updateMnemonicBinding(AbstractButton b) {
 145         int m = b.getMnemonic();
 146         if(m != 0) {




 105                                            "Button.actionMap");
 106 
 107         InputMap km = getInputMap(JComponent.WHEN_FOCUSED, c);
 108 
 109         SwingUtilities.replaceUIInputMap(c, JComponent.WHEN_FOCUSED, km);
 110     }
 111 
 112     /**
 113      * Unregister default key actions.
 114      *
 115      * @param c a component
 116      */
 117     public void uninstallKeyboardActions(JComponent c) {
 118         SwingUtilities.replaceUIInputMap(c, JComponent.
 119                                          WHEN_IN_FOCUSED_WINDOW, null);
 120         SwingUtilities.replaceUIInputMap(c, JComponent.WHEN_FOCUSED, null);
 121         SwingUtilities.replaceUIActionMap(c, null);
 122     }
 123 
 124     /**
 125      * Returns the InputMap for condition {@code condition}. Called as
 126      * part of {@code installKeyboardActions}.
 127      */
 128     InputMap getInputMap(int condition, JComponent c) {
 129         if (condition == JComponent.WHEN_FOCUSED) {
 130             BasicButtonUI ui = (BasicButtonUI)BasicLookAndFeel.getUIOfType(
 131                          ((AbstractButton)c).getUI(), BasicButtonUI.class);
 132             if (ui != null) {
 133                 return (InputMap)DefaultLookup.get(
 134                              c, ui, ui.getPropertyPrefix() + "focusInputMap");
 135             }
 136         }
 137         return null;
 138     }
 139 
 140     /**
 141      * Resets the binding for the mnemonic in the WHEN_IN_FOCUSED_WINDOW
 142      * UI InputMap.
 143      */
 144     void updateMnemonicBinding(AbstractButton b) {
 145         int m = b.getMnemonic();
 146         if(m != 0) {


< prev index next >