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: Mixing Cocoa Java and Java AWT Q&A



you can mix native GUI element with java via
1. JAWT interfaces (fully documented and well supported)
2. CocoaComponent class (fully documented and well supported)
3.(?) it was suggestion on that list about changing peer for the AWT frame
but there wasn't definitive conclusion (AFAIK)


On Feb 27, 2004, at 12:01 AM, Greg Bolsinga wrote:

Hello-

The amount of Cocoa Java and Java AWT mixing suggested on this mailing list is interesting. The posts on this list are the only times I've personally heard of mixing these two technologies together.

It's good to know that this combination is working for some users, but the Apple and Sun suggested way of accessing platform specific native specialties from java is by using JNI. Accordingly, Apple has just created an official Technical Q&A about this matter. <http://developer.apple.com/qa/qa2001/qa1342.html>

When using JNI, the developer is made more aware of the issues involved with any platform specific issues. For example, while Java is thread crazy and fairly multiple thread aware, all of the rest of Mac OS X isn't always a good multi-threaded citizen without lots of preparation by the developer. When the developer is writing code with a native language while using the native API, hopefully they will be aware of all of the multiple threading issues involved.

For example, there are places in Cocoa Java that won't mix with Java AWT, such as when executing on the main AppKit thread is required. Cocoa's -performSelectorOnMainThread simply isn't accessible via Cocoa Java's NSObject (as it is with Obj-C). Java AWT by design doesn't allow any client java code to be executed on the AppKit main thread (perhaps modulo some bugs). So mixing the two technologies can have troubles, and isn't suggested.

Thanks!
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Do not post admin requests to the list. They will be ignored.


Dmitry Markman
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Mixing Cocoa Java and Java AWT Q&A (From: Greg Bolsinga <email@hidden>)



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.