Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

radebe

macrumors newbie
Original poster
Mar 14, 2008
17
0
Norwich, UK
I'm taking on a project which has already started development as a Windows XP application written in Java. It's my job to port it over to the Mac, whilst keeping it easy to continue to develop on multiple platforms. The thing is, I generally don't like running Java applications on my Mac myself, because they just don't look like they belong. Everything from the interface to the menus being in the wrong place, and the general look and feel. I'd love to be able to improve on this, to the point where the end user would have no clue that the application was written in Java. How would I go about this? I've looked into the Java-Cocoa API, but it seems to be depreciated now. Any help is greatly appreciated.
Thanks,
Luke
 
You could try and use something like Quaqua as LAF (http://www.randelshofer.ch/quaqua/index.html). It's not going to give you 100% native appearance but it does a pretty good job where it can.

The cost of using a cross platform toolkit is that you end up with the lowest common denominator functionality, so you will also need to try and keep the features you use to those that are well implemented.

(mini-rant, sorry)
The other thing is to realise that a great app is a great app regardless of whether it fits in perfectly with everything else. I used to feel in a similar way but now I wouldn't trade IntelliJ for Xcode, ever. However nice Xcode looks or however well it 'fits' into OS X, it is simply erm, Eclipsed in terms of ease of use and functionality by other Java IDEs (despite their occasional quirks and imperfect integration).

Depending on your end users, they might not know the difference anyway. What might be obvious through your developer's eyes is not always apparent from the point of view of the end user (who may also be in the function over form camp).

Finally, it might not be an immediate option, but I *think* (and would need to google to confirm this) that SWT might be upgraded to work on top of Cocoa, although that might be some time off.

(edit) if your menus are in the wrong place, make sure you are running, IIRC, with -Dapple.laf.useScreenMenuBar
 

iSee

macrumors 68040
Oct 25, 2004
3,540
272
Take the app as it runs on OS X now and review it, top to bottom, against the OS X human interface guidelines and identify all the discrepancies. You may be able to get most of the way to your ideal just by working on "cosmetic" issues.

It's a good place to start because most of these kinds of things are easy to deal with at a code level and have a big impact on the user's experience.
 

cube

Suspended
May 10, 2004
17,011
4,973
That's nice, but how do you make a native-looking Java Web Start application?

It seems you have to detect the platform from the User Agent string and give a different JNLP file just for Apple, with a tweaked application-desc.
 

radebe

macrumors newbie
Original poster
Mar 14, 2008
17
0
Norwich, UK
You can always wrap the business logic through JNI and do the interface in Cocoa
Can anyone advise me on whether or not this would be a good method? To be honest, seeing what people have already done with Quaqua doesn't seem to suggest that it'll be able to produce the integration I'd really like. Does anyone know what Firefox does in version 3? Obviously it's not Java - but does it have a native Cocoa interface for the toolbar etc. or is it just faked with themes? There are a few things that suggest to me that it's fake, but it's fairly convincing until you look really closely.
 

MacRumors Guy

macrumors member
Sep 17, 2008
82
0
Can anyone advise me on whether or not this would be a good method? To be honest, seeing what people have already done with Quaqua doesn't seem to suggest that it'll be able to produce the integration I'd really like. Does anyone know what Firefox does in version 3? Obviously it's not Java - but does it have a native Cocoa interface for the toolbar etc. or is it just faked with themes? There are a few things that suggest to me that it's fake, but it's fairly convincing until you look really closely.

It's not very easy to wrap the code through JNI.

Firefox uses XUL in every system but uses some cocoa elements. The core is written in c++ mostly so it's not very hard to get it to work with objective-C.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.