Package java.awt

Examples of java.awt.Robot$RobotDisposer


    ClientStartScreen.instance.virtualScreen.addMouseListener(vListener);
    ClientStartScreen.instance.virtualScreen.addMouseMotionListener(vListener);
    ClientStartScreen.instance.t.add(ClientStartScreen.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.
    log.debug("img"+img);
    ImageIcon image = new ImageIcon(img);
View Full Code Here


 
  public void testTestSocket(){
    try {
     
     
      Robot robot = new Robot();
     
      Rectangle screenRectangle = new Rectangle(0,0,400,400);
     
      BufferedImage imageScreen = robot.createScreenCapture(screenRectangle);
     
      ByteArrayOutputStream out = new ByteArrayOutputStream();
     
      //PNGEncoder
     
View Full Code Here

 
  public void testTestSocket(){
    try {
     
     
      Robot robot = new Robot();
     
      Rectangle screenRectangle = new Rectangle(0,0,20,20);
     
      BufferedImage imageScreen = robot.createScreenCapture(screenRectangle);
     
      int scaledWidth = Math.round(400 * ClientConnectionBean.imgQuality);
      int scaledHeight = Math.round(400 * ClientConnectionBean.imgQuality);
     
      Image img = imageScreen.getScaledInstance(scaledWidth, scaledHeight,Image.SCALE_SMOOTH);
View Full Code Here

 
  public void testTestSocket(){
    try {
     
     
      Robot robot = new Robot();
     
      Rectangle screenRectangle = new Rectangle(0,0,400,400);
     
      BufferedImage imageScreen = robot.createScreenCapture(screenRectangle);
     
      int scaledWidth = Math.round(400 * ClientConnectionBean.imgQuality);
      int scaledHeight = Math.round(400 * ClientConnectionBean.imgQuality);
     
      Image img = imageScreen.getScaledInstance(scaledWidth, scaledHeight,Image.SCALE_SMOOTH);
View Full Code Here

 
  public void testTestSocket(){
    try {
     
     
      Robot robot = new Robot();
     
      Rectangle screenRectangle = new Rectangle(0,0,400,400);
     
      BufferedImage imageScreen = robot.createScreenCapture(screenRectangle);
     
      ByteArrayOutputStream out = new ByteArrayOutputStream();
     
      //PNGEncoder
     
View Full Code Here

      log.debug("ClientVirtualScreenBean.vScreenSpinnerWidth / ClientConnectionBean.tileWidth "+(ClientVirtualScreenBean.vScreenSpinnerWidth / ClientConnectionBean.tileWidth));
      log.debug("ClientVirtualScreenBean.vScreenSpinnerHeight / ClientConnectionBean.tileHeight "+(ClientVirtualScreenBean.vScreenSpinnerHeight / ClientConnectionBean.tileHeight));
      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;
         
          //log.debug("-1- rectWidth,rectHeight"+rectWidth+","+rectHeight);
         
          if (rect_x + rectWidth > screenSize.width) {
            rectWidth = screenSize.width - rect_x;
          }
          if (rect_y + rectHeight > screenSize.height) {
            rectHeight = screenSize.height - rect_y;
          }
         
          //log.debug("-2- rectWidth,rectHeight"+rectWidth+","+rectHeight);
         
          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

      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

      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

    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

           
            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

TOP

Related Classes of java.awt.Robot$RobotDisposer

Copyright © 2018 www.massapicom. 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.