Tuning Java Swing apps for Mac OS X
tarkin writes "Sven Van Caekenberghe just finished a tutorial article, 'Tuning Java Swing applications for Mac OS X', that explains how to tune standard Java Swing applications to conform to the Mac OS X User Experience and make them virtually indistinguishable from native Mac OS X applications. Topics include handling basic Apple events, packaging applications, adding a custom icon, file dialogs, about boxes, preferences, customizing the menu bar, supporting Finder drag-and-drop, standard help, and basic multi-document support, as well as using MRJToolkit and MRJAppBuilder. The PDF of the article, as well as a Mac OS X disk image with a binary version of the two demo applications and the source code can downloaded from his home page."
For my apps (that are cross platform) I build the classes in java and the UI in whichever platform I'm using. This allows each program to look good on the intended platform. For Apple Cocoa (java) programming via the Interface Builder is a wonderful tool (and free to boot!). However, I'm not a big fan of Swing. It is very unresponsive on even the fastest systems and even though working with a program can be just as efficient, as all Mac OS 9 users can tell you OS X doesn't "feel" as fast. That is the perception of Java based programs (that aren't native compiled), they are just slow. Sun should really consider a non-backward compatible new set of UI components because Swing was just kiss and make up for AWT (painful beast). I hate the layout managers and building your own, while it is an option really doesn't help in quick development.
Yeah. Sure.
You don't know what you're talking about.
Applications can be slow. The OS is not slow.
Java on OSX is rather speedy, and compares favorably with the previous platform I've used it on, Linux.
Cocoa apps are totally speedy, as fast as C apps.
Carbon apps that are poorly made will be slow, and if they're really poor (like IE) they can slow the whole system down.
But your generalizations are just wrong.
Yeah, and you guys panned the ipod too: http://apple.slashdot.org/article.pl?sid=01/10/23
This looks like the best introduction:
http://www.eclipse.org/articles/Article-SWT-Design -1/SWT-Design-1.html
pooptruck
I thought that is what you got with Java on the mac.
I've been doing mostly server side stuff so I can't say for sure, but it is my understanding that you write a Swing UI Java App on the Mac and on the Mac you get the Aqua look and feel. This is from conversations with an Apple developer who was the person who wrote it, but I may have misunderstood.
At the very least it should be one of the choices for looks that you get with swing (Remember windows, metalic, etc?)
So you write a swing app and on OS X it looks like OS X and on Windows it looks like Windows and on Linux it looks like Windows and on Solaris it looks like Swing.
You're right about apple optimizing their JVM etc. The reason 1.4 is delayed (so the rumors go) is that they are doing a complete rewrite. From what I saw with 1.3 they've done some great improvements on what Sun ships.
Wouldn't realbasic do what you want as well? One language-- though it has C support as well-- and deploy on at least Windows and Mac with the same UI.
Inherently when you make a multi-platform dynamically-chosen-look and feel, or consistent look and feel across all platforms, there WILL be compromises because the platforms are different.
So, I'm not sure what you're looking for-- if you think that someone can make one that dynamically picks the right UI without any compromises (java's slowness, or ui variations) then I think you're not quite understanding the problem correctly.
Personally, I have no desire to support the windows platform anymore, so I just do everything in Cocoa with Objective-C. And objective-c rocks. I thought Java was the paragon of perfect languages, but I have to admit I like objective-c better.
Yeah, and you guys panned the ipod too: http://apple.slashdot.org/article.pl?sid=01/10/23
One reason for using the Aqua L&F, though, is that it is better optimized for OS X. Try running a complex application in Metal on OS X and again in Aqua. In my experiance the difference was quite aparent. You have a point though that the feel of java apps on OS X is still not quite right, but using Metal isn't any better (it just makes things more ugly).
Cocoa apps have the same file path problem. NSDocument based apps now use FSRef's as well as NSURL's so they don't, but if you write a Cocoa app that doesn't use NSDocument, its up to you to do the FSRef magic you need to track files based on their HFS+ id number.
Can I Play With Madness?