MoinMoin Logo
  • Comments
  • Immutable Page
  • Menu
    • Navigation
    • RecentChanges
    • FindPage
    • Local Site Map
    • Help
    • HelpContents
    • HelpOnMoinWikiSyntax
    • Display
    • Attachments
    • Info
    • Raw Text
    • Print View
    • Edit
    • Load
    • Save
  • Login

Navigation

  • Start
  • Sitemap
Revision 1 as of 2025-05-09 07:59:32
  • Java
  • Robot

Robot

The primary purpose of Robot is to facilitate automated testing of Java platform implementations.

  • RobotJavadoc

Sample code

   1 import java.awt.Robot;
   2 
   3 public class Main{
   4   public static int DELAY=10000;
   5   public static int MOVE=100;
   6   private static Robot robot;
   7 
   8   public static void main(String[] args){
   9     try{
  10       System.out.println("Hello");
  11       robot=new Robot();
  12       while(true){
  13         move(0,0);
  14         move(MOVE,0);
  15         move(MOVE,MOVE);
  16         move(0,MOVE);
  17       }
  18     }
  19     catch(Exception ex){
  20       ex.printStackTrace();
  21     }
  22   }
  23 
  24   public static void move(int x,int y){
  25     robot.mouseMove(x,y);
  26     robot.delay(DELAY);
  27   }
  28 }
  • MoinMoin Powered
  • Python Powered
  • GPL licensed
  • Valid HTML 4.01