* Use the 1.5 API to get the cursor position relative to the component. Return null
* if it fails (JDK <= 1.4).
*/
public static Point getCursorPosition(Component component) {
try {
Point pointer_location = getPointerLocation(component);
if (pointer_location != null) {
Point location = component.getLocationOnScreen();
pointer_location.translate(-location.x, -location.y);
pointer_location.move(pointer_location.x, transformY(component, pointer_location.y));
return pointer_location;
}
} catch (IllegalComponentStateException e) {