I have a program that uses the following code:
public void mouseMoved(MouseEvent e) { mousex = e.getX(); mousey = e.getY(); if(mousex >= 700) { try { Robot robot = new Robot(); robot.mouseMove(0, 0); } catch (AWTException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } if(mousex <= 100) { Robot robot; try { robot = new Robot(); robot.mouseMove(0, 0); } catch (AWTException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }
All this works fine, except for one. It sets the position of the cursor on the screen, not the jframe. Also, when I say (mousex> = 700), it also gets it from the screen. I need to know how to change it to jframe. Thanks.
source share