Imitating 2 keyboard buttons at the same time like ALT+F4

hello,
was just wonderin how to Imitatate 2 keyboard buttons at the same time like ALT+F4. i am using the Robot class to make the key board pressing and they are working fo one button. i tried two buttons like this
robot.keyPress(KeyEvent.ALT_MASK+KeyEvent.VK_F4);but no luck. anyone know how to do this
thanks
martin

martinnaughton wrote:
sorry was just trying to do CTRL button but it does not like this bit of code.
robot.keyPress(KeyEvent.CTRL_DOWN_MASK);
                    robot.keyPress(KeyEvent.VK_UP);gives me an exception of invalid code.It does not seem to like DOWN_MASK attributes in java.
any way else around it
thanks
martinDon't confuse the modifier bitmask codes with the key codes:
robot.keyPress(KeyEvent.VK_CONTROL);

Similar Messages

Maybe you are looking for