The keyDown and keyUp actions

The keyDown() method is used to simulate the action of pressing and holding a key. The keys that we are referencing here are the Shift, Ctrl, and Alt keys. The keyUp() method is used to release the key that is already pressed using the keyDown() method. The API syntax for the keyDown() method is as follows:

public Actions keyDown(Keys theKey) throws IllegalArgumentException

An IllegalArgumentException is thrown when the passed key is not one of the Shift, Ctrl, and Alt keys. The API syntax for the keyUp() method is as follows:

public Actions keyUp(Keys theKey)

The keyUp action performed on a key, on which a keyDown action is not already being performed, will result in some unexpected results. So, we have to make sure we perform the keyUp action after a keyDown action is performed.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.27.202