Simple example: 2 JTextFields
, one for a spanish word another one for it's translation.
Is there a way to preserve keyboard layout per JTextField
so that the user wouldn't have to switch back and forth?
TIA.
Simple example: 2 JTextFields
, one for a spanish word another one for it's translation.
Is there a way to preserve keyboard layout per JTextField
so that the user wouldn't have to switch back and forth?
TIA.
If you know exactly the layout of the Spanish keyboard in question you could theoretically process KeyEvents yourself, translating them into the appropriate character. However this would not be an easy thing to do. You would probably end up inserting characters into the textfields yourself.
Yes, this demo code uses the keyboard layout for the selected locales in each text field:
Tested on Windows XP Home with EN and ES keyboard layouts installed (via Control Panel > Regional and Language Options > Languages > Details...). See the Java Input Method Framework for more details.
No, keyboard layouts are managed by the OS or desktop environment.