Nowadays in some office, it is required to stay on your desk and work for office hours.
The employees are being tracked depending upon the login hours on their systems.
Sometimes it also happens that if someone is not on their desk for even 5 minutes then the information goes to the manager.
So to avoid these scenarios it is better to make a utility class in java to make the random movement of the mouse pointer. This will let the admin assume that employee is on the seat.
To make this type of utility we will use the Robot class of java.awt package and we will use the mouseMove(x,y) method of Robot class. x and y are the coordinates.
The employees are being tracked depending upon the login hours on their systems.
Sometimes it also happens that if someone is not on their desk for even 5 minutes then the information goes to the manager.
So to avoid these scenarios it is better to make a utility class in java to make the random movement of the mouse pointer. This will let the admin assume that employee is on the seat.
To make this type of utility we will use the Robot class of java.awt package and we will use the mouseMove(x,y) method of Robot class. x and y are the coordinates.
Below is the program to move the mouse from one corner to another diagonally.
import java.awt.Robot; public class MyUtilityToMoveMouse { public static void main(String... args) throws Exception { int x = 0, y = 0; boolean bool = true; Robot robot = new Robot(); while (true) { robot.mouseMove(x++, y++); Thread.sleep(20); } } } |
Below is the program to move the mouse in zig-zag fashion like the lifeline.
import java.awt.Robot; public class MyUtilityToMoveMouse { public static void main(String... args) throws Exception { int x = 100, y = 400; boolean bool = true; Robot robot = new Robot(); while (true) { robot.mouseMove(x, y); if (bool) { x += 5;y += 5; } else { x += 5;y -= 5; } if (y == 420) bool = false; else if (y == 380) bool = true; if (x==1300)x=100; Thread.sleep(20); } } } |
Refer the video tutorial :
☛ Next >> Custom Exception In Java
We can create our own custom exception in Java. This can be done by ...
Nice sir
ReplyDeleteThanks Ankita!
Delete