void updateMnemonicBinding(AbstractButton b){
  int m=b.getMnemonic();
  if (m != 0) {
    InputMap map=SwingUtilities.getUIInputMap(b,JComponent.WHEN_IN_FOCUSED_WINDOW);
    if (map == null) {
      map=new ComponentInputMapUIResource(b);
      SwingUtilities.replaceUIInputMap(b,JComponent.WHEN_IN_FOCUSED_WINDOW,map);
    }
    map.clear();
    map.put(KeyStroke.getKeyStroke(m,BasicLookAndFeel.getFocusAcceleratorKeyMask(),false),"pressed");
    map.put(KeyStroke.getKeyStroke(m,BasicLookAndFeel.getFocusAcceleratorKeyMask(),true),"released");
    map.put(KeyStroke.getKeyStroke(m,0,true),"released");
  }
 else {
    InputMap map=SwingUtilities.getUIInputMap(b,JComponent.WHEN_IN_FOCUSED_WINDOW);
    if (map != null) {
      map.clear();
    }
  }
}

void updateMnemonicBinding ( AbstractButton b ) { int m = b . getMnemonic ( ) ; if ( m != 0 ) { InputMap map = SwingUtilities . getUIInputMap ( b , JComponent . WHEN_IN_FOCUSED_WINDOW ) ; if ( map == null ) { map = new ComponentInputMapUIResource ( b ) ; SwingUtilities . replaceUIInputMap ( b , JComponent . WHEN_IN_FOCUSED_WINDOW , map ) ; } map . clear ( ) ; map . put ( KeyStroke . getKeyStroke ( m , BasicLookAndFeel . getFocusAcceleratorKeyMask ( ) , false ) , "pressed" ) ; map . put ( KeyStroke . getKeyStroke ( m , BasicLookAndFeel . getFocusAcceleratorKeyMask ( ) , true ) , "released" ) ; map . put ( KeyStroke . getKeyStroke ( m , 0 , true ) , "released" ) ; } else { InputMap map = SwingUtilities . getUIInputMap ( b , JComponent . WHEN_IN_FOCUSED_WINDOW ) ; if ( map != null ) { map . clear ( ) ; } } }
resets the binding for the mnemonic in the when_in_focused_window ui inputmap .
