Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cursor position



Subject: cursor position
From: Piotr Rychlik <email@hidden>

Is there any (platform independent) method of getting the cursor
position?

I have not found anything in Java to do so, and am using a native
method to call the Carbon method GetGlobalCursor. If you need to
handle a range of Macs you might need as many as 4 different native
methods: 68K & OS 7/8, PPC & OS 7/8/9, PPC & OS X pre Java 1.4.1,
PPC & OS X 10.2+ w/Java 1.4.1+.

Watch out for the fact that QuickDraw points use 16-bit short ints
for the co-ordinates, and they are ordered in the reverse of AWT.
AWT uses x,y order, QuickDraw uses vertical,horizontal (which maps
to y,x).

GetGlobalMouse may or may not work with Java 1.4.1 due to Java 1.4.1
switching over from Carbon to Cocoa. If not you'll need to write a
"C callable wrapper function" for the JNI native method to call, which
in turn will make the appropriate Cocoa call. I haven't tracked down
what Cocoa call would be appropriate yet. Hopefully GetGlobalMouse will
continue to work with 1.4.1.

-DCZ
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.