Slashdot Log In
Tuning Java Swing apps for Mac OS X
Posted by
pudge
on Wed Oct 09, 2002 01:05 PM
from the the-more-mac-app-developers-the-better dept.
from the the-more-mac-app-developers-the-better dept.
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."
This discussion has been archived.
No new comments can be posted.
Tuning Java Swing apps for Mac OS X
|
Log In/Create an Account
| Top
| 37 comments
| Search Discussion
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Apple Tuning Java Swing (Score:3, Funny)
Not bad... (Score:4, Informative)
Perhaps the next thing we need is skinnable Swing?
Re:Not bad... (Score:4, Informative)
My method of java development (Score:5, Insightful)
Re:SWT? (Score:5, Informative)
This looks like the best introduction:
http://www.eclipse.org/articles/Article-SWT-Design -1/SWT-Design-1.html [eclipse.org]
Best Tuning Advice (for real) (Score:4, Informative)
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.
Re:Best Tuning Advice (for real) (Score:5, Interesting)
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.
One way to tell it is a java app (Score:1, Funny)
No point trying to dress it up
Re:Java on OS X??? Got to be kidding... (Score:5, Interesting)
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.
Re:He's right. (Score:5, Interesting)
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.