Hey all.
I'm a gamer, and I can get absorbed by whatever game I'm playing fairly
easily. So I want to write a program that can take a given time and, at
that time, force the computer to Alt-Tab out of the program, or
simulate some other series of keystrokes. I can handle setting up the
multiple options on my own, but I want to know - can I simulate
keystrokes using calls to KeyEvent. If so, how, and if not, what should
I do instead?
Thanks in advance.
Thomas Weidenfeller - 16 Aug 2006 09:18 GMT
> If so, how, and if not, what should
> I do instead?
Consider using C instead of Java, since it gives you better access to
the system. And I would assume you have to do some type of system
programming to get it right.

Signature
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
Oliver Wong - 16 Aug 2006 22:10 GMT
> Hey all.
>
[quoted text clipped - 5 lines]
> keystrokes using calls to KeyEvent. If so, how, and if not, what should
> I do instead?
Use a robot: http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Robot.html
- Oliver
kaldrenon - 17 Aug 2006 00:56 GMT
> > Hey all.
> >
[quoted text clipped - 9 lines]
>
> - Oliver
Thanks Oliver. The Robot works great, I used JButton with a RobotButton
subclass, gave it a Robot and an array of ints, and passed in an array
of KeyEvent.VK_** for the series of key presses I needed.