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."
Isn't that an old Count Basie song?
Best Windows Freeware
Swing is much easier to create useful applications with; it's good to see that someone is helping go it cross-platform to the Mac, to where it makes sense with the system paradigm. Unfortunately the controls in the standard Swing package look a little too much like Windows 9X.
:-)
Perhaps the next thing we need is skinnable Swing?
-- We live in a world where lemonade is artificial and soap has real lemon.
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
Java is significantly faster on OS X than it is on Linux. It's my understanding the reason the Java versions lag a little behind is Apple helps optimize them to aid with the speed issues.
That being said, I just want a compiler that can build native apps with one code base. Yes I know C++ can "theoretically" do this, but not if you're trying to make it a true native app. I want to say build file menu and the compiler knows on apple it's integrated and on a PC it's got it's own menu interface, on linux you can choose how you want it laid out (SDI versus MDI).
This is the killer app for developers and I personally would pay several thousand for a development environment that could do this. I'll return to my pipe dream shortly.
This looks like the best introduction:
http://www.eclipse.org/articles/Article-SWT-Design -1/SWT-Design-1.html
pooptruck
The best advice I can give Mac OS X users who want to run a Swing app is to change the default L&F to something other than Aqua.
Swing apps are incapable of behaving like Mac apps. Thus using the Aqua theme for Swing apps is the absolute worst possible combination!
One of the key reasons Swing apps will NEVER behave like Mac apps is the Java file primitive. The misnomer File class should really be called FilePath. Since (100% Java) Swing apps use file paths as file primitives this implies that file paths are constant. Thus if you move/rename an open file (or host directory/non-root volume) the Swing app will become confused.
>80 column hard wrapped e-mail is not a sign of intelligent
>life
I have given up on the Eclipse IDE -- the checklists for downloading samples are all two pages long, their menus and dialogs are all non-standard, and I have not yet figured out what options to specify to actually run any of the samples I have built.
Is it just me or is Eclipse just impossible to figure out? I have used (for C++) everything from Code Warrior to Borland to VC++, but Eclipse has me completely stumped. I suppose I could figure it out if I devoted a couple weeks to it, but I just don't have that kind of time to evaluate something I am not sure is of any use.
As to the SWT, isn't that the kind of thing Microsoft got sued for?
As SWT is tightly coupled through JNI to the target system, you have to distribute a .DLL (some kind of extra software blob) with your SWT app for every possible target system. Yeah, yeah, AWT/Swing has to eventually call something native, but those customizations are part of the Java runtime you install for each target system, not some extra blob that you need to distribute.
Also, SWT is much more complete on Windows while the Linux version is "in progress" and the OS-X version is a distant dream. Now isn't this kind of write-once, run under Windows just the thing Microsoft got sued for?