1

Mac OS X features an 'About' screen for applications.

enter image description here

Defualt About screen

But how do I change the version number that is displayed, the icon shown, and add some text programmatically? I don't want a seperate Mac application bundle trough, I want to keep anything in a single multiplatform Jar file. Thank you.

DannyBoi
  • 636
  • 1
  • 7
  • 23
jobukkit
  • 2,490
  • 8
  • 26
  • 41
  • 1
    AFAIK the only way to do this is the application bundle. Mac-OS speficic behavior and platform independent code is a conflicting requirement... – Durandal Aug 14 '12 at 17:31
  • The dock icon can be set programmatically. The application name can be set programmatically. The about screen contents can't? :( – jobukkit Aug 14 '12 at 17:34
  • The about screen is not generated by Java I believe, but the executable that launches java. I guess the application name is derived from the Frame and by dock you mean something like a Trayicon using Desktop API? Those are under Java's control obviously. – Durandal Aug 14 '12 at 17:37
  • I have set the dock icon with `Application.getApplication().setDockIconImage(icon);` (`icon` is a java.awt.Image created some earlier in the code) and the application name was set by `System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Alfabet");` – jobukkit Aug 14 '12 at 17:40
  • 6
    I found [this article](http://www.devdaily.com/java/java-mac-osx-about-preferences-quit-application-adapter) which might be helpful – Robin Aug 14 '12 at 19:12
  • 3
    I don't believe it's possible to change the contents of the default About dialog, but you can just implement a handleAbout that shows whatever About dialog you want to create in Java. That also allows you to have an About dialog that's the same on all platforms. (And now I see that Robin linked an article showing you exactly how to do it, so +1.) – abarnert Aug 14 '12 at 19:29

1 Answers1

1

The way to do this was to use OSXAdapter and call its setAboutHandler(...) method pointing to your method for popping up an about dialog. But apparently that's legacy now.

martijno
  • 1,723
  • 1
  • 23
  • 53
  • Thanks, but your link is broken. – jobukkit Aug 16 '12 at 07:04
  • Really? It works for me. (Expands to different URL, though: http://developer.apple.com/library/mac/#/legacy/mac/library/samplecode/OSXAdapter/Introduction/Intro.html). – martijno Aug 16 '12 at 09:22
  • Sorry, the link didn't work because I was on my iPad. On my mac the link works. Thank you :) – jobukkit Aug 16 '12 at 09:27
  • 1
    Good for you @comBoy! Note that the code that I linked to uses the same `com.apple.eawt` classes as mentioned in @Robin's solution, but it does this reflectively so your code doesn't have to import those classes. Makes it easier to have platform independent code. – martijno Aug 28 '12 at 14:42