Examples of Robot


Examples of java.awt.Robot

      int yOffset = ClientVirtualScreenBean.vScreenSpinnerY;
     
      log.debug("tileNumberWidth,tileNumberHeight "+tileNumberWidth+","+tileNumberHeight);
      log.debug("xOffset,yOffset "+xOffset+","+yOffset);
     
      Robot robot = ClientVirtualScreenBean.robot;
      if (robot==null) robot = new Robot();
      Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
     
      for (int x=0;x<=tileNumberWidth;x++) {
       
        for (int y=0;y<=tileNumberHeight;y++) {
         
          int rect_x = xOffset + ( x * ClientConnectionBean.tileWidth );
          int rect_y = yOffset + ( y * ClientConnectionBean.tileHeight );
         
          log.debug("rect_x,rect_y,tileWidth,tileHeight "+rect_x+","+rect_y+","+ClientConnectionBean.tileWidth+","+ClientConnectionBean.tileHeight);
         
          int rectWidth = ClientConnectionBean.tileWidth;
          int rectHeight = ClientConnectionBean.tileHeight;
         
          if (rect_x + rectWidth > screenSize.width) {
            rectWidth = screenSize.width - rect_x;
          }
          if (rect_y + rectHeight > screenSize.height) {
            rectHeight = screenSize.height - rect_y;
          }
         
          if (rectWidth == 0 || rectHeight == 0) {
            continue;
          }
         
          Rectangle screenRectangle = new Rectangle(rect_x,rect_y,rectWidth,rectHeight);
         
          Rectangle shrinkedRectAngle =  new Rectangle(Math.round(rect_x * ClientConnectionBean.imgQuality) , Math.round(rect_y * ClientConnectionBean.imgQuality),
              Math.round(rectWidth * ClientConnectionBean.imgQuality), Math.round(rectHeight * ClientConnectionBean.imgQuality));
         
         
          BufferedImage imageScreen = robot.createScreenCapture(screenRectangle);
         
          int scaledWidth = Math.round(rectWidth * ClientConnectionBean.imgQuality);
          int scaledHeight = Math.round(rectHeight * ClientConnectionBean.imgQuality);
         
          Image img = imageScreen.getScaledInstance(scaledWidth, scaledHeight,Image.SCALE_SMOOTH);
View Full Code Here

Examples of java.awt.Robot

      int yOffset = ClientVirtualScreenBean.vScreenSpinnerY;
     
      log.debug("tileNumberWidth,tileNumberHeight "+tileNumberWidth+","+tileNumberHeight);
      log.debug("xOffset,yOffset "+xOffset+","+yOffset);
     
      Robot robot = ClientVirtualScreenBean.robot;
      if (robot==null) robot = new Robot();
      Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
     
      for (int x=0;x<=tileNumberWidth;x++) {
       
        for (int y=0;y<=tileNumberHeight;y++) {
         
          //We send only every 4th item
          int modulo = counter % 4;
         
          if (modulo == 0) {
         
            int rect_x = xOffset + ( x * tileWidth );
            int rect_y = yOffset + ( y * tileHeight );
           
            log.debug("rect_x,rect_y,tileWidth,tileHeight "+rect_x+","+rect_y+","+tileWidth+","+tileHeight);
           
            int rectWidth = tileWidth;
            int rectHeight = tileHeight;
           
            if (rect_x + rectWidth > screenSize.width) {
              rectWidth = screenSize.width - rect_x;
            }
            if (rect_y + rectHeight > screenSize.height) {
              rectHeight = screenSize.height - rect_y;
            }
           
            Rectangle screenRectangle = new Rectangle(rect_x,rect_y,rectWidth,rectHeight);
           
            Rectangle shrinkedRectAngle =  new Rectangle(Math.round(rect_x * ClientConnectionBean.imgQuality) , Math.round(rect_y * ClientConnectionBean.imgQuality),
                Math.round(rectWidth * ClientConnectionBean.imgQuality), Math.round(rectHeight * ClientConnectionBean.imgQuality));
           
            BufferedImage imageScreen = robot.createScreenCapture(screenRectangle);
           
            Image img = imageScreen.getScaledInstance(Double.valueOf(tileWidth * ClientConnectionBean.imgQuality).intValue(), Double.valueOf(tileHeight * ClientConnectionBean.imgQuality).intValue() ,Image.SCALE_SMOOTH);
            BufferedImage image = new BufferedImage(Double.valueOf(tileWidth * ClientConnectionBean.imgQuality).intValue(), Double.valueOf(tileHeight * ClientConnectionBean.imgQuality).intValue(),BufferedImage.TYPE_INT_RGB);
            Graphics2D biContext = image.createGraphics();
            biContext.drawImage(img, 0, 0, null);
View Full Code Here

Examples of java.awt.Robot

    StartScreen.instance.virtualScreen.addMouseListener(vListener);
    StartScreen.instance.virtualScreen.addMouseMotionListener(vListener);
    StartScreen.instance.t.add(StartScreen.instance.virtualScreen);     
   
    Rectangle screenRectangle = new Rectangle(screenSize);
    Robot robot = new Robot();
    BufferedImage imageScreen = robot.createScreenCapture(screenRectangle);   
   
    Image img = imageScreen.getScaledInstance(width, height ,Image.SCALE_SMOOTH);
    //imageScreen.
    System.out.println("img"+img);
    ImageIcon image = new ImageIcon(img);
View Full Code Here

Examples of java.awt.Robot

           
            String action = returnMap.get("action").toString();
           
            if (action.equals("onmouseup")) {
             
               Robot robot = new Robot();
               
               //VirtualScreenBean
               
  //          Integer x = Math.round ( ( ( Float.valueOf(returnMap.get("x").toString()).floatValue() *VirtualScreenBean.vScreenResizeX )/VirtualScreenBean.vScreenSpinnerWidth) / Ampl_factor) ;
  //          Integer y = Math.round ( ( ( Float.valueOf(returnMap.get("y").toString()).floatValue() *VirtualScreenBean.vScreenResizeY )/VirtualScreenBean.vScreenSpinnerHeight)/ Ampl_factor) ;
  //           
              
               //logger.debug("x 1 "+returnMap.get("x"));
              
               Float scaleFactor = Float.valueOf(VirtualScreenBean.vScreenSpinnerWidth) / Float.valueOf(VirtualScreenBean.vScreenResizeX);
              
               //logger.debug("x 1 scaleFactor "+scaleFactor);
              
               Float part_x1 = ( ( Float.valueOf(returnMap.get("x").toString()).floatValue() * scaleFactor  ) / Float.valueOf(Ampl_factor) );
              
               //logger.debug("x 1 part_x1 "+part_x1);
              
               Integer x = Math.round ( part_x1 + VirtualScreenBean.vScreenSpinnerX  );

              
               Integer y = Math.round ( ( ( Float.valueOf(returnMap.get("y").toString()).floatValue() * VirtualScreenBean.vScreenSpinnerHeight / VirtualScreenBean.vScreenResizeY) / Ampl_factor) + VirtualScreenBean.vScreenSpinnerY;
           
            
               //logger.debug("x|y "+x+" || "+y);
             
                robot.mouseMove(x, y);
                robot.mouseRelease(InputEvent.BUTTON1_MASK);
             
            } else if (action.equals("onmousedown")) {
             
               Robot robot = new Robot();
              
               Float scaleFactor = Float.valueOf(VirtualScreenBean.vScreenSpinnerWidth) / Float.valueOf(VirtualScreenBean.vScreenResizeX);
               Float part_x1 = ( ( Float.valueOf(returnMap.get("x").toString()).floatValue() * scaleFactor  ) / Float.valueOf(Ampl_factor) );
               Integer x = Math.round ( part_x1 + VirtualScreenBean.vScreenSpinnerX  );
               Integer y = Math.round ( ( ( Float.valueOf(returnMap.get("y").toString()).floatValue() * VirtualScreenBean.vScreenSpinnerHeight / VirtualScreenBean.vScreenResizeY) / Ampl_factor) + VirtualScreenBean.vScreenSpinnerY;
             
                robot.mouseMove(x, y);
                robot.mousePress(InputEvent.BUTTON1_MASK);
             
            } else if (action.equals("mousePos")) {
             
              Robot robot = new Robot();
               
               Float scaleFactor = Float.valueOf(VirtualScreenBean.vScreenSpinnerWidth) / Float.valueOf(VirtualScreenBean.vScreenResizeX);
              
               Float part_x1 = ( ( Float.valueOf(returnMap.get("x").toString()).floatValue() * scaleFactor  ) / Float.valueOf(Ampl_factor) );
              
               Integer x = Math.round ( part_x1 + VirtualScreenBean.vScreenSpinnerX  );
              
               Integer y = Math.round ( ( ( Float.valueOf(returnMap.get("y").toString()).floatValue() * VirtualScreenBean.vScreenSpinnerHeight / VirtualScreenBean.vScreenResizeY) / Ampl_factor) + VirtualScreenBean.vScreenSpinnerY;
           
                robot.mouseMove(x, y);
             
            } else if (action.equals("onkeydown")) {
             
              Robot robot = new Robot();
             
              Integer key = Integer.valueOf(returnMap.get("k").toString()).intValue();
           
              //logger.debug("key onkeydown -1 "+key);
              boolean doAction = true;
             
              if (key == 221) {
                key = 61;
              } else if (key == -1) {
               
                String charValue = returnMap.get("c").toString();
               
                //key = KeyEvent.VK_ADD;
                doAction = false;
               
                for (Iterator<Integer> iter = this.currentPressedKeys.keySet().iterator();iter.hasNext();) {
                  Integer storedKey = iter.next();
                 
                  robot.keyRelease(storedKey);
                 
                }
               
                this.currentPressedKeys = new HashMap<Integer,Boolean>();
               
                this.pressSpecialSign(charValue, robot);
              } else if (key == 188) {
                key = 44;
              } else if (key == 189) {
                key = 109;
              } else if (key == 190) {
                key = 46;
              } else if (key == 191) {
                key = 47;
              }
             
              //logger.debug("key onkeydown -2 "+key);
             
              if (doAction) {
               
                this.currentPressedKeys.put(key, true);
               
                robot.keyPress(key);
              }
             
            } else if (action.equals("onkeyup")) {
             
              Robot robot = new Robot();
             
              Integer key = Integer.valueOf(returnMap.get("k").toString()).intValue();
           
              //logger.debug("key onkeyup 1- "+key);
             
              boolean doAction = true;
             
              if (key == 221) {
                key = 61;
              } else if (key == -1) {
                doAction = false;
              } else if (key == 188) {
                key = 44;
              } else if (key == 189) {
                key = 109;
              } else if (key == 190) {
                key = 46;
              } else if (key == 191) {
                key = 47;
              }
             
              //logger.debug("key onkeyup 2- "+key);
             
              if (doAction) {
               
                if (this.currentPressedKeys.containsKey(key)) {
                  this.currentPressedKeys.remove(key);
                 
                  robot.keyRelease(key);
                 
                }
               
              }
             
            } else if (action.equals("paste")) {
             
              Robot robot = new Robot();
             
              String paste = returnMap.get("paste").toString();
           
              this.pressSpecialSign(paste, robot);
             
            } else if (action.equals("copy")) {
             
              Robot robot = new Robot();
             
              String paste = this.getHighlightedText(robot);
             
              HashMap<Integer,String> map = new HashMap<Integer,String>();
              map.put(0,"copiedText");
              map.put(1,paste);
             
              String clientId = returnMap.get("clientId").toString();
           
              //public synchronized int sendMessageWithClientById(Object newMessage, String clientId)
             
              invoke("sendMessageWithClientById",new Object[] { map, clientId }, this);
             
            } else if (action.equals("show")) {
             
              Robot robot = new Robot();
             
              String paste = this.getClipboardText();
             
              HashMap<Integer,String> map = new HashMap<Integer,String>();
              map.put(0,"copiedText");
View Full Code Here

Examples of java.awt.Robot

    ScreenShareRTMPT.instance.virtualScreen.addMouseListener(vListener);
    ScreenShareRTMPT.instance.virtualScreen.addMouseMotionListener(vListener);
    ScreenShareRTMPT.instance.t.add(ScreenShareRTMPT.instance.virtualScreen);

    Rectangle screenRectangle = new Rectangle(screenSize);
    Robot robot = new Robot();
    BufferedImage imageScreen = robot.createScreenCapture(screenRectangle);

    Image img = imageScreen.getScaledInstance(width, height ,Image.SCALE_SMOOTH);
    //imageScreen.
    logger.debug("img"+img);
    ImageIcon image = new ImageIcon(img);
View Full Code Here

Examples of java.awt.Robot

   
    // prepare CaptureLocation
    captureDimension = new Rectangle(Double.valueOf(screenDimension.getWidth()).intValue(), Double.valueOf(screenDimension.getHeight()).intValue());
    captureDimension.setLocation(x, y);
   
    rt = new Robot();
  }
View Full Code Here

Examples of java.awt.Robot

            validate();
            setVisible(true);
            requestFocus();
            try
            {
                Robot robot = new Robot();
                robot.mouseMove(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode().getWidth() + 48, -48);
            }
            catch(AWTException ex)
            {}
        }
    }
View Full Code Here

Examples of java.awt.Robot

            projector.getRectifyingHomography(camera, tempH);
            JavaCV.fractalTriangleWave(tempFloat, tempH);
            cvConvertScale(tempFloat, imageToProject, 255, 0);
        } else if (virtualSettings.desktopScreenNumber >= 0) {
            desktopScreen = CanvasFrame.getScreenDevice(virtualSettings.desktopScreenNumber);
            robot = new Robot(desktopScreen);
            int w = virtualSettings.desktopScreenWidth,
                h = virtualSettings.desktopScreenHeight;
            if (w <= 0 || h <= 0) {
                DisplayMode dm = desktopScreen.getDisplayMode();
                w = dm.getWidth();
View Full Code Here

Examples of java.awt.Robot

      
        tEnv.addObjRelation("EventProducer",
                            new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
            public void fireEvent() {
                try {                            
                    Robot rob = new Robot();
                    rob.mouseMove(point.X + 2, point.Y + 7);
                    rob.mousePress(InputEvent.BUTTON1_MASK);                   
                    rob.mouseMove(point.X + 400, point.Y);
                    rob.mouseRelease (InputEvent.BUTTON1_MASK);                                       
                } catch (java.awt.AWTException e) {
                    System.out.println("desired child doesn't exist");
                }
            }
        });
View Full Code Here

Examples of java.awt.Robot

        try
        {
            int button =
                rightClick ? InputEvent.BUTTON3_MASK : InputEvent.BUTTON1_MASK;
           
            Robot robot = new Robot();
            robot.mouseMove(p.x, p.y);
            while (display.readAndDispatch());
            try { Thread.sleep(20); } catch (InterruptedException _) { }
            robot.mousePress(button);
            while (display.readAndDispatch());
            try { Thread.sleep(20); } catch (InterruptedException _) { }
            robot.mouseRelease(button);
            while (display.readAndDispatch());
            try { Thread.sleep(20); } catch (InterruptedException _) { }
        }
        catch (AWTException e) { throw new RuntimeException(e); }
    }
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.