Java OS X Lion About Menu

前端 未结 1 2003
花落未央
花落未央 2021-01-20 00:05

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 see

1条回答
  •  北海茫月
    2021-01-20 00:45

    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
            }
    
        });
    

    0 讨论(0)
提交回复
热议问题