Mac OS comes bundled with Java already installed by default and strives to make the user interface easy for users.
However, for those that like coding Java applications it might seem like a daunting task to make it look user friendly. If we were coding a platform specific application, we'd just select an icon to include at runtime and be done with it.
But in java - it's just too complicated and most pages about this topic that I stumbled upon were not really shedding much light on the matter.
Eventually, I discovered that Mac OS by default also includes some nifty tools to solve this matter.
There is a life-saver application called "Jar Bundler" and you can find it inside the /Developer/Applications/Utilities folder within the Mac OS. I've found it on this page: http://developer.apple.com/mac/library/documentation/Java/Conceptual/Jar_Bundler/Packaging/Packaging.html
--------------
Using this tool is a snap, open it up, select the Jar file that you intend to run and select an icon.
Before clicking on "Create application", you will need to choose a folder that will serve as base for your application. My advice is to pick an empty folder inside the desktop.
-------------
Other tweaks:
You can click on the "Set working directory to inside application package" to ensure that any files that your jar creates are kept inside the package (to keep it nice and tidy).
The icon format used by this tool is .icns but don't worry, you can use the online service at http://iconverticons.com/ to convert the file without any pain. If you want to make your image transparent, just open it on gimp, click on "Colors" --> "Colors to Alpha" and then "Ok". If you save the image as .png then it will be lossless and preserve transparency.
That's all. Hope this tip help others creating good looking apps with Java for OSX.
:)
No comments:
Post a Comment