chandlerethan
2012-01-07 13:19:09
Okay so thanks to Wyn10, I know how to properly make a runescape loader. I've set up a thread when the loader starts that takes buffered image screenshots of the loader screen and saves them to a file (this is because I was experimenting with the screen capture method in the Robot class). Well I know that using the robot class for your key and mouse events takes control of your mouse and that you have to create a new KeyEvent using its constructor and using
1.)
source - the Component that originated the event
id - an integer identifying the type of event
when - a long integer that specifies the time the event occurred
modifiers - the modifier keys down during event (shift, ctrl, alt, meta) Either extended _DOWN_MASK or old _MASK modifiers should be used, but both models should not be mixed in one event. Use of the extended modifiers is preferred.
keyCode - the integer code for an actual key, or VK_UNDEFINED (for a key-typed event)
keyChar - the Unicode character generated by this event, or CHAR_UNDEFINED (for key-pressed and key-released events which do not map to a valid Unicode character)
Anyways, I know how to get the source (which is the applet that the game is displayed on, the id is an int such as keyPressed/keyReleased, not sure about the when, modifiers is obvious, the keyCode is something such as VK_H/VK_SPACE, and I'm not sure about the keyChar. If anyone could explain how to find the "when" integer, and the source I would appreciate it.
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(KeyEvent/MouseEvent). The only thing I don't know is what exactly to put in the "when" parameter, and the source parameter. the constructors are (the 2 that aren't deprecated):1.)
public KeyEvent(Component source, int id, long when, int modifiers, int keyCode, char keyChar)
2.) public KeyEvent(Component source, int id, long when, int modifiers, int keyCode, char keyChar, int keyLocation)
the details in the Javadoc are: source - the Component that originated the event
id - an integer identifying the type of event
when - a long integer that specifies the time the event occurred
modifiers - the modifier keys down during event (shift, ctrl, alt, meta) Either extended _DOWN_MASK or old _MASK modifiers should be used, but both models should not be mixed in one event. Use of the extended modifiers is preferred.
keyCode - the integer code for an actual key, or VK_UNDEFINED (for a key-typed event)
keyChar - the Unicode character generated by this event, or CHAR_UNDEFINED (for key-pressed and key-released events which do not map to a valid Unicode character)
Anyways, I know how to get the source (which is the applet that the game is displayed on, the id is an int such as keyPressed/keyReleased, not sure about the when, modifiers is obvious, the keyCode is something such as VK_H/VK_SPACE, and I'm not sure about the keyChar. If anyone could explain how to find the "when" integer, and the source I would appreciate it.