So I just started learning Java this year and I'm trying to take on what I believe to be a simple project.
I'm trying to write a program that will control my keyboard and beat the Snake web app on facebook. To do this I had a plan of writing code using the robot class to control my keys but I've been running into a few problems.
First and foremost, is there a way to tell java to switch to my Firefox window when it starts? Right now I'm having to try to click run and then quickly click on my firefox browser in order for the keystrokes to register in Firefox.
Secondly, would the best way to do this simply be by using robot.delay(int ms); in between key presses? This would naturally take quite a bit of trial and error to get the times down just right so I was just wondering if there would be any better way to do this.