tags:

views:

209

answers:

3

Hello,

If I write an application in java, does it use native widgets if run on Mac OS X? Or does it use "lookalike" widgets provided by the java runtime?

Thanks.

+2  A: 

Yes. Apple provide version of jvm, which uses native widgets.

developer.apple.com/business/macmarket/tekadence.html

Benefits of Apple’s Java implementation include access to Aqua user interface elements “for free” through Swing, native preemptive multitasking, multiprocessing support (with no additional coding required), and treatment of JAR files as shared libraries. This last advance improves the speed of execution and reduces the RAM footprint of applications which rely on the same archive, such as applications within suites. Additionally, Mac OS X plugs the Java windowing toolkit directly into the Mac’s native windowing toolkit, giving Java applications and applets the graphics performance benefits of Quartz, one of three powerful graphics technologies on Mac OS X.

osgx
the apple jvm is only official jvm for mac os x. there are no sum jvm for mac os x.
osgx
there are articles, which says, that apple do some rewrite of jvm with cocoa.
osgx
+2  A: 

You can use SWT which uses native OS X controls on OS X but also remains multi-platform (provided that platform has the SWT library compiled for it). However, it is not as flexible or will look as nice as having direct access to the UI components themselves (an abstraction has to be made).

alt text

You could also have a look at MacWidgets which attempt to be like native OS X widgets but aren't, but work cross-platform.

alt text

Chris Dennett
A: 

All Java Swing components are look-alike, not native widgets.

Swing's configurability is a result of a choice not to use the native host OS's GUI controls for displaying itself. Swing "paints" its controls programmatically through the use of Java 2D APIs, rather than calling into a native user interface toolkit.

There is an OSX look and feel, provided by the Apple JVM, but it is never actually native controls. The other approach is SWT, but I honestly haven't seen many applications other than Eclipse using it, and I never really find that they look very good.

Russell Leggett
Another big application using SWT is Vuze (formelly Azureus), a very popular bittorrent client.
Cesar
yeah, and then they hid the ugly thing behind "advanced mode"
Russell Leggett
if the apple LAF is not native, how can it use top menu line? Or how can it use the Quartz?
osgx
Apple added custom hooks in the VM for the top menu. http://developer.apple.com/mac/library/documentation/Java/Conceptual/Java14Development/07-NativePlatformIntegration/NativePlatformIntegration.html
Russell Leggett