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.
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.
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.
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).
You could also have a look at MacWidgets which attempt to be like native OS X widgets but aren't, but work cross-platform.
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.