How can i control keyboard through programming?
Hello
Suppose my program contain text area and I want change the
layout of the keyboard to any order I want.
The problem is how I can change the character what is in specify key?
for example:
If the user press The key (T) print in text area (J) directly
without appear T and change it with J in text area.
Thank you in advance.
Re: How I can control Keyboard?
Hello Mohd and welcome to the Java Programming Forums.
I don't think its possible to swap the keyboards mapping in this way.
What you could do is write an ActionListener method so that when a character is typed into the jtextarea, it is automatically updated and swapped with the desired character.
I'm sure it will be quite complicated though.
Have you wrote any code already? I will try to post some kind of example to help you get started..
Re: How I can control Keyboard?
Hi JavaPF,
I solved this problem as you said
I used ActionListener and when user type for example j
type i or anything else
in method keyTyped I used consume() to stop typing any character to jtextarea
and in keyPressed() here was my coding.
Get the character or keycode of the key and
did what I want.
Thank you.
Re: How I can control Keyboard?
Hello Mohd,
Thats brilliant! I'm glad you solved your problem.
Would it be possible to post your code here? It may help others in the future :)