Stories
Slash Boxes
Comments

News for nerds, stuff that matters

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.
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.
Display Options Threshold:
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)

    by L. VeGas (580015) on Wednesday October 09 2002, @01:10PM (#4418026) Homepage Journal
    Isn't that an old Count Basie song?
  • Not bad... (Score:4, Informative)

    by NetRanger (5584) on Wednesday October 09 2002, @01:22PM (#4418135) Homepage
    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? :-)
    • Re:Not bad... (Score:4, Informative)

      by smileyy (11535) <smileyy@fitterhappier.nu> on Wednesday October 09 2002, @01:46PM (#4418346) Homepage
      You mean the different Swing look-and-feels? Already done.
      [ Parent ]
    • My method of java development (Score:5, Insightful)

      by BoomerSooner (308737) on Wednesday October 09 2002, @01:58PM (#4418455) Homepage Journal
      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.
      [ Parent ]
    • Re:Not bad... by foobar104 (Score:2) Wednesday October 09 2002, @02:09PM
    • 2 replies beneath your current threshold.
  • Best Tuning Advice (for real) (Score:4, Informative)

    by anarkhos (209172) on Wednesday October 09 2002, @04:59PM (#4420035)
    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.
    • Re:Best Tuning Advice (for real) (Score:5, Interesting)

      by Molz (87066) on Wednesday October 09 2002, @06:08PM (#4420433) Journal

      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.

      [ Parent ]
  • by Anonymous Coward on Thursday October 10 2002, @03:07PM (#4426956)
    It will be slow.

    No point trying to dress it up ;)

    • 1 reply beneath your current threshold.
  • by BitGeek (19506) on Wednesday October 09 2002, @02:20PM (#4418653) Homepage

    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.
    [ Parent ]
    • He's right. by BoomerSooner (Score:3) Wednesday October 09 2002, @03:21PM
      • Re:He's right. (Score:5, Interesting)

        by BitGeek (19506) on Wednesday October 09 2002, @04:14PM (#4419687) Homepage


        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.

        [ Parent ]
      • Re:He's right. by 1155 (Score:1) Thursday October 10 2002, @12:26PM
    • Reply to reply, from the Original Anonymous Coward by Anonymous Coward (Score:1) Thursday October 10 2002, @03:40PM
  • 4 replies beneath your current threshold.