I was wondering how I could make an if statement:
if("up".equals(message))
{
System.exit(0); //What I want to change
}
Act as if a key was pressed?
Like per-say I want this if statement to make it so that when up equals the message it will output a keypress like I pressed that key in the first place. I can't explain it too good but I hope this helps more
Just for anyone in the future I used this
try {
Robot robot = new Robot();
// Simulate a key press
robot.keyPress(KeyEvent.VK_A); // press a
robot.keyRelease(KeyEvent.VK_A); // release a
} catch (AWTException e) {
e.printStackTrace();
}
Thanks to Jdsfighter