java - deactivate mnemonic for JButton -
i need deactivate mnemonic jbutton. using 3rd party api, set mnemonic "alt c". want remove mnemonic , wants set nothing (i.e wants remove mnemonic) compbutton.
// alt + 'c' selects comp. compbutton.setmnemonic(keyevent.vk_c);
how using compbutton.setmnemonic(0);
edit:
i saw javax/swing/abstractbutton.java
:
/** * returns key bindings associated object * * @return key bindings, if supported, of object; * otherwise, null * @see accessiblekeybinding * @since 1.4 */ public accessiblekeybinding getaccessiblekeybinding() { int mnemonic = abstractbutton.this.getmnemonic(); if (mnemonic == 0) { return null; } return new buttonkeybinding(mnemonic); }
therefore, compbutton.setmnemonic(0);
looks better compbutton.setmnemonic(-1);
.
Comments
Post a Comment