Examples of Mouse


Examples of org.rsbot.client.input.Mouse

  public TMousePosition(final Bot bot) {
    client = bot.getClient();
  }

  public int drawLine(final Graphics render, int idx) {
    final Mouse mouse = client.getMouse();
    if (mouse != null) {
      final int mouse_x = mouse.getX();
      final int mouse_y = mouse.getY();
      final String off = mouse.isPresent() ? "" : " (off)";
      StringUtil.drawLine(render, idx++, "Mouse Position: (" + mouse_x + "," + mouse_y + ")" + off);
    }
    return idx;
  }
View Full Code Here

Examples of org.rsbot.client.input.Mouse

  public DrawMouse(Bot bot) {
    client = bot.getClient();
  }

  public void onRepaint(final Graphics render) {
    Mouse mouse = client.getMouse();
    if (mouse != null) {
      int mouse_x = mouse.getX();
      int mouse_y = mouse.getY();
      int mouse_press_x = mouse.getPressX();
      int mouse_press_y = mouse.getPressY();
      long mouse_press_time = mouse.getPressTime();
      render.setColor(Color.GREEN);
      render.drawLine(mouse_x - 5, mouse_y - 5, mouse_x + 5, mouse_y + 5);
      render.drawLine(mouse_x + 5, mouse_y - 5, mouse_x - 5, mouse_y + 5);
      if (System.currentTimeMillis() - mouse_press_time < 1000) {
        render.setColor(Color.RED);
View Full Code Here

Examples of org.rsbot.script.methods.Mouse

    }
  }

  private void redispatch(final MouseEvent e) {
    if (bot != null && bot.getLoader().getComponentCount() > 0) {
      final Mouse mouse = bot.getMethodContext().mouse;
      if (mouse == null) {
        return; // client cannot currently accept events
      }
      final boolean present = mouse.isPresent();
      final Component c = bot.getLoader().getComponent(0);
      // account for horizontal offset
      e.translatePoint(-offset.x, -offset.y);
      // fire human mouse event for scripts
      dispatchHuman(c, e);
View Full Code Here

Examples of org.sikuli.api.robot.Mouse

import org.sikuli.api.visual.ScreenRegionCanvas;

public class MultiScreenExample {

  public static void main(String[] args) throws IOException  {
    Mouse mouse = new DesktopMouse();
   
    // iterate through each screen, the mouse cursor will traverse along the edges
    // of a rectangle centered on each screen clockwise, and then clicks on the dog image
    int numOfScreens = DesktopScreen.getNumberScreens();
    for (int screenId = 0; screenId < numOfScreens; screenId++){
     
      ScreenRegion screenRegion = new DesktopScreenRegion(screenId);
      ScreenRegion innerRegion = Relative.to(screenRegion).shorter(100).narrower(100).getScreenRegion();

      // create a canvas to draw visualization on the screen
      Canvas c = new ScreenRegionCanvas(screenRegion);
      c.addBox(innerRegion);
      c.addLabel(innerRegion.getCenter(), "Screen " + screenId).withFontSize(30);
      c.addImage(Relative.to(innerRegion).center().above(200).getScreenLocation(), ImageIO.read(Images.Dog));
      c.show();
     
      // hover the mouse cursor to each corner of the inner circle
      mouse.hover(Relative.to(innerRegion).topLeft().getScreenLocation());
      mouse.hover(Relative.to(innerRegion).topRight().getScreenLocation());
      mouse.hover(Relative.to(innerRegion).bottomRight().getScreenLocation());
      mouse.hover(Relative.to(innerRegion).bottomLeft().getScreenLocation());
     
      // find the dog and click on it
      ScreenRegion dog = innerRegion.find(new ImageTarget(Images.Dog));
      mouse.click(dog.getCenter());
     
      c.hide();
    }
   
 
View Full Code Here

Examples of org.sikuli.api.robot.Mouse

    // Display "Hello World" next to the found target for 3 seconds
    Canvas canvas = new DesktopCanvas();
    canvas.addLabel(r, "Hello World").display(3);
   
    // Click the center of the found target
    Mouse mouse = new DesktopMouse();
    mouse.click(r.getCenter());
  }
View Full Code Here

Examples of org.sikuli.api.robot.Mouse

       
    DragDropFrame imageFrame = new DragDropFrame(backgroundImage,dragTargetImage);
    imageFrame.autoClose(10000);
   
    ScreenRegion s = new DesktopScreenRegion();   
    Mouse mouse = new DesktopMouse();

    URL imageURL = Images.OSXDockIcon;               
    Target imageTarget = new ImageTarget(imageURL);
   
    ScreenRegion r = s.wait(imageTarget,1000);
    mouse.drag(r.getCenter());
   
   
    imageURL = Images.GoogleMicrophoneIcon;               
    imageTarget = new ImageTarget(imageURL);
   
    r = s.wait(imageTarget,1000);
    mouse.drop(r.getCenter());
   
   
    ScreenLocation c = mouse.getLocation();   
    mouse.drag(c);
    mouse.drop(Relative.to(c).left(200).above(50).getScreenLocation());

  }   
View Full Code Here

Examples of sprites.io.Mouse

    //Error Handling ...
    if(e == null){
      return;
    }
    checkMouse();
    Mouse mouse = this.config.getMouse();
    int button = e.getButton();
    switch(button){
      case MouseEvent.BUTTON1 : mouse.press(Mouse.Button.LEFT); break;
      case MouseEvent.BUTTON2 : mouse.press(Mouse.Button.MIDDLE); break;
      case MouseEvent.BUTTON3 : mouse.press(Mouse.Button.RIGHT); break;
    }
  }
View Full Code Here

Examples of sprites.io.Mouse

    //Error Handling ...
    if(e == null){
      return;
    }
    checkMouse();
    Mouse mouse = this.config.getMouse();
    int button = e.getButton();
    switch(button){
      case MouseEvent.BUTTON1 : mouse.release(Mouse.Button.LEFT); break;
      case MouseEvent.BUTTON2 : mouse.release(Mouse.Button.MIDDLE); break;
      case MouseEvent.BUTTON3 : mouse.release(Mouse.Button.RIGHT); break;
    }
  }
View Full Code Here

Examples of sprites.io.Mouse

    }
  }
 
  private void checkMouse(){
    checkConfig();
    Mouse mouse  = this.config.getMouse();
    if(mouse == null){
      throw new IllegalStateException("Fatal error: Mouse within Configuration is a nullpointer!");
    }
  }
View Full Code Here

Examples of utils.Mouse

    private static void init() {
        GlobalData.GRAPHICS_DIMENSIONS = Dimensions.TWO_DIMENSION;
        theWindow = new JavaWindow( "Tree test", WINDOW_WIDTH, WINDOW_HEIGHT );
        theWindow.addKeyListener( ( input = InputManager.getInstance() ) );
        //mouseInput = new Mouse();
        theWindow.addMouseListener( ( mouseInput = new Mouse() ) );
        theWindow.addMouseMotionListener( mouseInput );
        //theWindow.addMouseListener( new MockMouse() );
        allGraphics = new LinkedList< GraphicsObject >();
        pf = new Points();
        sf = new Sizes();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.