Fix Mnemonic Problem In JTable

Mnemonics are those underlined letters that you see in labels and buttons that when activated via the ALT key + the letter, will activate that label/button.

However, when a JTable is included in the user interface and has editing capabilities enabled, you may be surprised that instead of activing a button by pressing ALT + key on the keyboard, the JTable activates editing mode.

How to fix it then? You need to override the processKeyBinding() method of the JTable class. Do it like this

This solution was from a forum called and fixed this mnemonic problem when a JTable with cell editors is present in the same user interface area.

Related Posts Plugin for WordPress, Blogger...

Leave a Reply

Your email address will not be published. Required fields are marked *