Java OS X Lion About Menu
Asked Answered
B

1

4

I am trying to override the about menu in a Java Application on OS X Lion or anything from Leopard & above. How do I do that? The tutorials I have read so far do not seem up-to-date, some classes are no longer in the Java Mac SDK and others' events are not fired, alas.

Thanks in advance!

Bonnee answered 30/7, 2011 at 15:54 Comment(1)
MyFrame extends JFrame implements com.apple.eawt.AboutHandler and MyFrame extends JFrame implements MRJAboutHandler, where MRJAboutHandler no longer exists, whereas, when using AboutHandler, the method is not fired :(Bonnee
S
5

You might find the instructions on http://simplericity.com/2007/10/02/1191336060000.html interesting if you use maven as the underlying Apple instructions on http://developer.apple.com/library/mac/documentation/Java/Reference/1.5.0/appledoc/api/index.html require reflection to use reliably on non-Apple JDK's too.

"This class permits your Java application to respond Mac OX X-specific Apple events. To use this class:

  • Obtain an instance of Application.

  • Instantiate one or more objects that implement the ApplicationListener interface. (A convenience class, com.apple.eawt.ApplicationAdaptor, is provided. Create an instance of it for default handling of the events in the ApplicationListener interface).

  • Implement handlers for the appropriate events.

  • Register the ApplicationAdaptor(s) with the Application object. "

Perhaps you missed this part?


EDIT: It appears this was seriously changed in 10.6 update 3 and 10.5 update 8. Show a normal Java dialogue box inside the handler in

    Application a = Application.getApplication();
    a.setAboutHandler(new AboutHandler() {

        public void handleAbout(AboutEvent arg0) {
// here
        }

    });
Stalinabad answered 30/7, 2011 at 16:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.