I know how to call 1 using keyevent which should be like aaa.keyPress(KeyEvent.VK_1);
Now I need to type (.) dot? But I could not find (KeyEvent.VK_DOT) or some similar command. Please help
Thanks
The "dot" is called a period; hence it's VK_PERIOD
.
Very old question, very basic question, but the correct answer is missing.
For regular dot use:
KeyEvent.VK_PERIOD
For numpad dot use:
KeyEvent.VK_DECIMAL
VK_PERIOD should do what you need.
VK_PERIOD
WILL NOT get it done, by the way. Sometimes the "painfully obvious" answer doesn't quite work.
VK_PERIOD
DOES NOT pick up the numpad's dot. It gets the main period, but you're left wonder why it no worky for numpad.
In case you need to respect numpad's dot (which is a strong possibility for all conceivable uses of a dot) you'll have to go with
keyEvent.getKeyChar() == '.'
Or (if you must have your KeyCodes)
keyEvent.getKeyCode() == KeyEvent.VK_PERIOD || keyEvent.getKeyCode() == KeyEvent.VK_DECIMAL
will also work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With