View RSS Feed

Robot

Java Robot

  1. Robot class Control functions

    by , 03-04-2012 at 11:46 AM
    Robot class uses these control functions:

    Mouse control functions

    void mouseMove(int x, int y):To coordinate (x,y), mouse cursor is moved by using this function. At screen’s top corner (left), coordinated are shown.
    Java Code:
    void mousePress(int buttons)
    void mouseRelease(int button)
    Button clicks are performed by this function pair. Input arguments are as following:
    java.awt.event.InputEvent.BUTTON1_MASK   // left mouse button 
    java.awt.event.InputEvent.BUTTON2_MASK
    ...

    Updated 03-04-2012 at 12:07 PM by Java AWT

    Categories
    Robot
  2. How to use Robot class in Java?

    by , 03-04-2012 at 11:43 AM
    For controlling the keyboard or mouse, class java.awt.Robot will be used. Any kind of operation regarding mouse or keyboard can be performed once one has the control over mouse & keyboard. Usually such class type is used while doing test automation.

    Robot class which handles the keyboard events will be shown up by using this code. If this code is run, a notepad will be opened to write down “HI MY FRIEND”.
    Java Code:
    import java.awt.AWTException; 
    import java.awt.Robot;
    ...
    Categories
    Robot
  3. Robot Class

    by , 03-04-2012 at 11:42 AM
    In many applications, like self running demos or test automation, the Robot class is used. It is required in those circumstances where keyboard control as well as mouse is needed. “Native system” input events are generated by the class robot. The basic purpose is to facilitate the Java platform’s automated testing implementations.

    Generation of the input events by the Robot class is totally a separate thing as compared to the posting of the events to AWT components or event queue. ...
    Tags: robot class Add / Edit Tags
    Categories
    Robot