Problem creating virtual keyboard

0

I have a problem that when I press the button of my application, that when I change the screen to write on the previous screen  for a moment it shows me the next image in full screen (this is shown when you press the ALT and TAB keys together), and then you type in the previous screen. How can I prevent him from showing me the image, how could he do it?

my code is as follows:

          private void btn_escribirActionPerformed(java.awt.event.ActionEvent evt) {                                             
  Robot robot = null;
   try {
        robot = new Robot();
    } catch (AWTException ex) {
        Logger.getLogger(Ven.class.getName()).log(Level.SEVERE, null, ex);
    }

    //este codigo me sirve cambiar de pantalla y escribo en la pantalla 
    //   anterior
    // en la que se ecribira
    // por ejemplo en el bloc de notas
     //y tambien con este codigo me sale imagen
     robot.keyPress(KeyEvent.VK_ALT);
    robot.keyPress(KeyEvent.VK_TAB);
    robot.keyRelease(KeyEvent.VK_TAB);
    robot.keyRelease(KeyEvent.VK_ALT);

     try {
        Thread.sleep(200);//
    } catch (InterruptedException ex) {
        Logger.getLogger(Ven.class.getName()).log(Level.SEVERE, null, ex);
    }
       //con esto escribo la palabra "hola que tal"
    StringSelection stringSelection = new StringSelection("hola que tal");
    Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
    clipboard.setContents(stringSelection, stringSelection);
    robot.keyPress(KeyEvent.VK_CONTROL);
    robot.keyPress(KeyEvent.VK_V);
    robot.keyRelease(KeyEvent.VK_V);
    robot.keyRelease(KeyEvent.VK_CONTROL);

}          
    
asked by Ayrton Axel 23.07.2018 в 03:06
source

0 answers