Monday, June 9, 2008

Java 5.0 + OSX 10.5 + Netbeans 6.1

It seems OSX 10.5 has issues with JTextBox's created with NetBeans.

And probably others. In short, I just bundled my application with "Quaqua" Look & Feel, and it fixed the NullPointerException's. See Quaqua's page for how to do this (there's some really easy to follow instructions on there).

I'd like to rant that I've found multiple people complaining about the OSX implementation of swing causing NullPointerException's in the EVT (Event Dispatch Thread) of their applications, but mostly with Java 1.3 or Java 1.4, and commonly with the "Save As" dialog. Its a bit embarrassing that Macintosh's Look & Feel is buggier than the Open-Source community supported one, but this isn't the only case where the open-source alternative is much better in the Java world. (http://jtds.sourceforge.net/benchTest.html)

Here's some similar posts:
http://lists.apple.com/archives/java-dev/2003/Apr/msg00858.html
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4464821
https://list.scms.waikato.ac.nz/pipermail/wekalist/2007-June/010296.html
https://list.scms.waikato.ac.nz/pipermail/wekalist/2007-June/010302.html
http://forum.java.sun.com/thread.jspa?threadID=563831&messageID=2776789
http://fmeyer.org/archives/2007/10/29/about-apple-java6-and-crap/
http://blogs.sun.com/wangwj/entry/netbeans_6_final_on_mac

Why blame Apple?

Since there's no stack-trace to any applications it seems its inherently caused by the OSX LAF (Look & Feel). Here's the error I get...

java.lang.NullPointerException
apple.laf.CUIAquaTextField.paintSafely(CUIAquaTextField.java:91)

Experts will argue, a GUI NullPointerException is due to poor threading (when you don't properly use invokeAndWait(), or invokeLater() when updating the GUI) but in this project, I'm using NetBeans to do its own threading (besides, these errors are thrown before any threads are actually started!!!), and in NetBeans defense, it works for Metal L&F, Windows L&F, GTK L&F.

Hope this helps some in their struggles. Post a reply if you've found a non "Quaqua" work-around. :)


-Tres

No comments: