Skip to main content

Ctrl and Alt keys in JTextField

Please note these forums are being decommissioned and use the new and improved forums at
No replies
Joined: 2011-07-03

How I can "deprive of" Ctrl keys and Left Alt from Swing?

There is specific keyboard layout for input characters with diacritics marks which use Shift, Ctrl and Alt as "modifiers". For example, key "a" input char 'ā' (a with macron), Shift + "a" - 'á' (a with acute), Ctrl + "a" - 'ǎ' (a with caron) , Alt + "a" - 'à' (a with grave) and so on.

When I use this keyboard in JTextField, pressing any Ctrl or Left Alt suppres char input (required character doesn't appear in field), though Right Alt work rightly...

It seems that something is wrong. And what am I to do?

So far as the same "diacritics chars" is even 17 pieces, to catch their keys and analyse pressing three modifiers seems to me not elegant solution.

Suggest me, professionals, can I "in one step" or "globally" or by "one coding trick" deprive of Ctrl keys and Left Alt from Swing and incline it to live according to "law of simple text field" and answer adequately on keyboard actions?

I removed all keyStrokeBindings, cleaned ActionMaps, InputMaps and KeyMaps for JTextField and their parent - no result...