I want to create a virtual numeric keyboard, so that when I press U I get a 4, I produces a 5, O produces a 6, and so on:
789 789
uio becomes 456
jkl 123
m 0
But I need the rest of the keyboard to continue working as usual. I have tried this and some other solutions, but they are not useful to me, because on my JTextField I get 4U5I6O
(or U4I5O6
depending on which solution I implement).
I need to get rid of the letter, and produce only the number.
Does anybody know a proper solution?
Thanks.
If you are typing directly to JTextField
, then I recommend to use DocumentFilter
.
As an example of DocumentFilter
, see: