java awt.Robot class - A magic in your hand !!!!!!!

Hello friends, i am back with some new stuff for you. Today i am gonna tell you a very interesting and powerful library in java programming language.and that is java awt.Robot class.Using this class one can control your mouse, keypress control , mouse scrolling events , screenshots and many more.in short using this class whole control of you computer or laptop is in your hand.

now how to operate it ? Here i am assuming that you have a basic knowledge of java language. first you need to create a class and need to import awt.robot class   using  import java.awt.Robot;  statement.



now to do different different task you need to remember some syntaxes. for that refer oracle documantation on this.to visit that page click here .  now here i am giving you one example to move mouse  pointer on screen.you can begin with this simple example. later on in my next posts i will give you more complex  programs.

just write this code in your java environment and run it.




import java.awt.Robot;

public class MouseEvent {

 public static void main(String[] args) throws Exception {

            Robot robot = new Robot();
            robot.mouseMove(400, 550);     // set x,y co-ordinates as per your needs

 }
}






Comments

Popular posts from this blog

MATLAB program to find Frequency Modulation