how do you get the location of the mouse


1 2 3 4 5 | MouseInfo mouse = Greenfoot.getMouseInfo(); //use this to get the x position of the mouse. mouse.getX(); //use this to get the y position of the mouse. mouse.getY(); |
1 2 3 4 5 | MouseInfo mouse = Greenfoot.getMouseInfo(); if (mouse!= null ){ mx = mouse.getX(); my = mouse.getY(); } |