mouseMove not working appropriately

Can any one tell me what is the problem with the following code. I am trying to reposition the mouse cursor at the (0,0) co-ordinate of mouseTest frame, when mouse is dragged within it. But surprisingly mouse cursor goes to the (0,0) co-ordinate of the parent frame.

public class mouseTest extends JFrame {

public mouseTest() {

enableEvents(AWTEvent.MOUSE_EVENT_MASK|AWTEvent.MOUSE_MOTION_EVENT_MASK);

setSize(new Dimension(400,400));

setVisible(true);

}

public void processMouseMotionEvent(MouseEvent me){

if(me.getID() == MouseEvent.MOUSE_DRAGGED){

try{

Robot r = new Robot();

r.mouseMove(0,0);

}catch(AWTException ae){

}

}

else super.processMouseMotionEvent(me);

}

public static void main (String args[]) {

new mouseTest ().show ();

}

}

Any help will be appreciated. thanks in advance.

[929 byte] By [92025] at [2007-9-26 3:43:15]
# 1
Not all that surprising since Robot.mouseMove specifies that it moves the mouse to the given position in screen coordinates.Simply adjust the coordinates by adding together the locations of all parent frames.Hope this helps.
KPSeal at 2007-6-29 12:21:46 > top of Java-index,Desktop,Core GUI APIs...
# 2
or to avoid all the adding, jus use the getLocationOnScreen() function.
Ragnvald at 2007-6-29 12:21:46 > top of Java-index,Desktop,Core GUI APIs...
# 3
thanks for your reply. yeah I failed to notice that Robot mouseMove reposition the mouse cursor with respect to screen.
92025 at 2007-6-29 12:21:46 > top of Java-index,Desktop,Core GUI APIs...
# 4
If you are running under some flavors of MS Windows, you will have to set your mouse cursor speed control slider to the middle value for Robot.mouseMove to work correctly.
bratcher at 2007-6-29 12:21:46 > top of Java-index,Desktop,Core GUI APIs...
# 5

> If you are running under some flavors of MS Windows,

> you will have to set your mouse cursor speed control

> slider to the middle value for Robot.mouseMove to work

> correctly.

Apologies for resurrecting an old post but on Windows 2000, I'm using the arrow keys to control fine cursor movement via a Robot that does mouseMove() calls. All works fine except that on screen the y co-ordinate seems to jump 2 on every alternative key press and not move on the others (but the actual values from the MouseEvent are smooth). Anyone know if this is the above problem? My mouse options don't allow the speed to be changed.

gseel at 2007-6-29 12:21:46 > top of Java-index,Desktop,Core GUI APIs...