Xserve colocation for MacSlash provided by   Digital Forest
MacSlash A Daily Dose of Mac News and Discussion
MacSlash
MacSlash
» FAQ
» Discussions
» Journals
» Messages
» Topics
» Authors

» Preferences
» Technorati Profile
» Older Stuff
» Past Polls
» Submit Story


Search MacSlash:
 







Listed on BlogShares

Team One Tickets

» Hannah Montana/Miley Cyrus at Houston Rodeo tickets
» Garth Brooks at Staples Center tickets
» Super Skins Party Tickets
» Penthouse Desire SuperParty Tickets
» National Finals Rodeo Tickets
» Cher Tickets Las Vegas
» Cirque du Soleil
» Las Vegas Hotels
» Houston Rodeo Tickets
» Using A Ticket Broker
» PBR Rodeo Tickets
» Joe Calzaghe vs Bernard Hopkins Tickets
» Oscar De La Hoya vs Floyd Mayweather Tickets
» De La Hoya Tickets
» Hanah Montana Tickets
» Joe Calzaghe Tickets
» Maxxis EnduroCross Tickets
» MAXIM Super Bowl Party
» How To Spot A Counterfeit Super Bowl Ticket


Shameless Plugs
» Mac Poker Site
» 2008 Democratic Primary Info


 
Tuning Java Swing Applications For Mac OS X
posted by j on Saturday October 05, @03:25PM
from the swingin'-baby dept.
Software Sven Van Caekenberghe writes "I 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 undistinguishable 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 my homepage. "

Reviews: iPod For Windows | Ask MacSlash: Leaving Classic Behind  >

 

 
MacSlash Login
Nickname:

Password:

[ Create a new account ]

Related Links
  • Apple
  • Sven Van Caekenberghe
  • my homepage
  • More on Software
  • Also by J
  • This discussion has been archived. No new comments can be posted.
    Tuning Java Swing Applications For Mac OS X | Login/Create an Account | Top | 16 comments | Search Discussion
    Threshold:
    The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
    article (Score:0)
    by Anonymous Coward on Saturday October 05, @03:44PM (#3325)
    at 21 pages, i would say that it's getting towards O'reilly pocket book size =] Have you thought of trying out the cocoa-java AppKit interfaces? Since they are just calls to native code, they are mucho faster than Swing could ever be.
    Swing (Score:2, Interesting)
    by superkendall on Monday October 07, @12:38AM (#3458)
    User #3184 Info
    The great thing about this article for me as a developer, is that I can develop apps in Swing that look good and work well in OS X (my development platform of choice), but that I can also run under Windows and Linux.

    I've developed Swing apps before and found Swing a pretty powerful GUI platform to work with. For basic kinds of things pretty much any GUI toolkit will work, but when you need complex custom widgets that leverage exisiting widgets as much as possible, Swing really shines.

    --> Kendall (proper spelling is this post brought to you by Safari [if I remembered to turn it on])
    Re:article (Score:1)
    by tchristney on Sunday October 06, @05:08PM (#17517)
    User #1847 Info | http://macslash.org/

    Except that Java2D has serious problems when using hwaccel. Using AffineTransforms causes whatever you are drawing to end up all over the place. If you set com.apple.hwaccel to false everything works fine. Swing might work well but if you are using the Java2D APIs then you have to turn off hwaccel, losing the potential advantage it might have given you.

    Of course this has been mentioned many times on java-dev@lists.apple.com over the last few weeks.

    "Concentrate on promoting rather than demoting." - CmdrTaco.

    Thanks! (Score:3, Interesting)
    by weberik on Saturday October 05, @04:48PM (#17529)
    User #3584 Info | http://www.fireteamconsulting.com/newsletter/
    Regardless of what may follow in the way of criticism, I'd just like to note that Sven didn't *have to* post this information on his home page. It's obvious that he put a lot of thought and effort into this.

    So thanks for taking the time and making the effort, Sven! I for one appreciate it.

    "Folks, the Mac platform is through... ." - John C. Dvorak, 1998

    Re:speed? (Score:0)
    by Anonymous Coward on Sunday October 06, @08:23AM (#17551)
    Not really. Some of the tips MIGHT make them run a little faster, but it doesn't address the obvious speed discrepancies people have been moaning about.

    BTW, I was able to figure this out myself in about 30 seconds by actually following the links provided.

    Re:article (Score:1)
    by tarkin (tarkin@SPAMPROOF.pandora.be) on Sunday October 06, @11:28AM (#17558)
    User #5412 Info
    The clear purpose of this article is give information to current Java developers to make their applications attractive on Mac OS X. Yes, cocoa-java is an option, but it isn't an option with already completed applications.--- MACOSX solved the 'Productivity Paradox' for me ;-)
    speed? (Score:0)
    by Anonymous Coward on Saturday October 05, @10:46PM (#17568)
    Does the tutorial include instructions on speeding up java apps so that they run as fast as java on Windows?
    Re:article (Score:2, Interesting)
    by mpowers on Saturday October 05, @10:11PM (#17570)
    User #7030 Info | http://mpowers.net
    they are mucho faster than Swing could ever be

    That smells like conjecture. Here's the counter-intuitive fact: Swing with Apple's hwaccel support for Swing is just plain faster than Cocoa in scrolling, table column resizing, window resizing, and other intensive rendering tasks. Yes, I was as surprised as you are.

    The good news is that with Jaguar, Cocoa has caught up.

    To be sure, since both the Aqua PLAF and Cocoa use the Appearance Manager, I think the Appearance Manager is really what was slow. And Jaguar has certainly sped that up with judicious use of hardware acceleration (QuartzExtreme).

    open event (Score:0)
    by Anonymous Coward on Monday October 07, @09:48AM (#17601)
    "how to tune standard Java Swing applications to conform to the Mac OS X User Experience and make them virtually undistinguishable from native Mac OS X applications"
    ... is just impossible !

    You can't catch the open event to know if the application was started because someone double-clicked on a document, so you can't display this document when the application starts (it's a MacOS X bug)... How can you make the user experience even remotely similar to a native app without this ?

    I haven't tried Jaguar yet, but I guess Apple never bothered to fix this bug. From what I heard, they even added another one: now there is no way to fix the 10.1 bug preventing you to display a "save as" dialog when the user quits the app...
    Re:open event (Score:0)
    by Anonymous Coward on Wednesday October 09, @04:31AM (#17666)
    From what I read (but I haven't checked so far), the workaround for the quit handler suggested by Apple before 10.2 has a bad result in 10.2 (where the initial bug is fixed, but the old workaround has the result of making the apps quit without warning). They changed their suggested workaround since then, but it doesn't mean all the Java apps developped before 10.2 suddenly changed at the same time they changed their workaround !
    I'm just upset they didn't take their own workaround into consideration when fixing the bug.
    However, you're bringing good news, and I'm glad there is finally a way to run Java apps on MacOS (it's been a while Apple has been advertising about having the best platform for Java development, but it wasn't the case).

    Damien
    Re:open event (Score:0)
    by Anonymous Coward on Wednesday October 09, @04:18AM (#17668)
    I have tried, but I don't see anything related to this bug in the article. To make sure, I tried the JPEG Viewer application, dragging a file to it to open it, and it opens the app without opening the file (as I expected). Maybe this bug was fixed in 10.2 (I'm still using 10.1) ?
    Thank you Sven (Score:1)
    by asterizk (asterizk@yahoo.com) on Monday October 07, @07:57AM (#17768)
    User #1780 Info
    I just wanted to publicly express my thanks for posting this article! Much appreciated. Thank you, Sven!

    Krishen
    Re:open event (Score:1)
    by svc2 on Tuesday October 08, @02:44AM (#17826)
    User #8142 Info | http://homepage.mac.com
    Indeed, this used to be a problem before, not so in 10.2: the open document handler stuff just works, try the JPEG Viewer example.

    The problem with the quit handler is also fixable: see Apple's Technical QA 1187 'Prompting the user with MRJQuitHandler'

    sven

    Thank you Sven (Score:0)
    by Anonymous Coward on Monday October 07, @03:03AM (#17886)
    That article was very informative, and I will be referring to it all the time from now on. Thanks for making it available to us all!
    Re:Swing (Score:1)
    by asterizk (asterizk@yahoo.com) on Monday October 07, @07:54AM (#17889)
    User #1780 Info
    The great thing about this article for me as a developer, is that I can develop apps in Swing that look good and work well in OS X (my development platform of choice), but that I can also run under Windows and Linux.
    This is exactly what I love about this document. I haven't read the whole thing yet, but if what I read on page two is correct -- "...we can do all this and maintain full standard Java Swing compatibility... ...in other words, the application will continue to run on other platforms as before" -- I'm overjoyed. My current project involves writing a 100% Pure Java application. I couldn't be happier!
    Re:open event (Score:2)
    by tchristney on Monday October 07, @01:13PM (#25970)
    User #1847 Info | http://macslash.org/

    Turns out you can. Try reading the article, you might find that the impossible is possible...

    "Concentrate on promoting rather than demoting." - CmdrTaco.

      That was fun while it lasted. Powered by Slash

    [ home | contribute story | older articles | past polls | faq | authors | preferences ]
    Copyright © 1999-2007 MacSlash Inc.