|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface KeyboardInputSimulationFixture
Understands simulation of keyboard input on a GUI component.
| Method Summary | |
|---|---|
KeyboardInputSimulationFixture |
pressAndReleaseKey(KeyPressInfo keyPressInfo)
Simulates a user pressing given key with the given modifiers on this fixture's GUI component. |
KeyboardInputSimulationFixture |
pressAndReleaseKeys(int... keyCodes)
Simulates a user pressing and releasing the given keys on this fixture's GUI component. |
KeyboardInputSimulationFixture |
pressKey(int keyCode)
Simulates a user pressing given key on this fixture's GUI component. |
KeyboardInputSimulationFixture |
releaseKey(int keyCode)
Simulates a user releasing the given key on this fixture's GUI component. |
| Method Detail |
|---|
KeyboardInputSimulationFixture pressAndReleaseKeys(int... keyCodes)
keyCodes - one or more codes of the keys to press.
NullPointerException - if the given array of codes is null.
IllegalArgumentException - if any of the given code is not a valid key code.
IllegalStateException - if the component is disabled.
IllegalStateException - if the component is not showing on the screen.KeyEventKeyboardInputSimulationFixture pressKey(int keyCode)
keyCode - the code of the key to press.
IllegalArgumentException - if the given code is not a valid key code.
IllegalStateException - if the component is disabled.
IllegalStateException - if the component is not showing on the screen.KeyEventKeyboardInputSimulationFixture pressAndReleaseKey(KeyPressInfo keyPressInfo)
InputEvent masks.
The following code listing shows how to press 'CTRL' + 'C' in a platform-safe way:
JTextComponentFixture textBox = dialog.textBox("username");
textBox.selectAll()
.pressAndReleaseKey(key(VK_C).modifiers(controlOrCommandMask()));
keyPressInfo - specifies the key and modifiers to press.
NullPointerException - if the given KeyPressInfo is null.
IllegalArgumentException - if the given code is not a valid key code.
IllegalStateException - if the component is disabled.
IllegalStateException - if the component is not showing on the screen.KeyboardInputSimulationFixture releaseKey(int keyCode)
keyCode - the code of the key to release.
IllegalArgumentException - if the given code is not a valid key code.
IllegalStateException - if the component is disabled.
IllegalStateException - if the component is not showing on the screen.KeyEvent
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||