BlacK
BlacK

Reputation: 351

How to modify the "About" OS X dialog panel in a Java application?

What is the simplest way to customize this panel considered that the application is written in Java 7 and my favorite environment is Mac Os?

About panel

Thanks

Upvotes: 2

Views: 202

Answers (1)

andrewdotn
andrewdotn

Reputation: 34833

You need to use the com.apple.eawt classes. For example, this scratch program shows a Java dialog instead of the Mac one.

import javax.swing.*;

import com.apple.eawt.*;
import com.apple.eawt.AppEvent.*;

public class Foo
    extends JPanel
    implements AboutHandler
{

    public static void main(String[] args)
    throws Exception
    {
        Foo r = new Foo();
    }

    public Foo() {
        Application.getApplication().setAboutHandler(this);
    }

    public void handleAbout(final AboutEvent e) {
        JOptionPane.showMessageDialog(null, "hello, world");
    }

}

Unfortunately all of this stuff is deprecated. Apple used to develop and support all of this but doesn’t anymore, and there are a lot of dead links around the internet.

I figured out the API from reading the Javadoc comments in the source code for these classes.

And running mdfind -name apple | grep -i jar turned up /usr/share/java/Stubs/AppleJavaExtensions.jar on my machine, which allowed the above program to compile and run on my machine. But I have no idea where that file came from or if it’ll be in future versions of Mac OS.

Upvotes: 3

Related Questions