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

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -