且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Java OS X Lion关于菜单

更新时间:2023-11-10 12:22:28

您可能会在 http://developer.apple.com/library/mac/documentation/Java/Reference/1.5.0 /appledoc/api/index.html 也需要进行反射,才能在非Apple JDK上可靠地使用.

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.

此类允许您的Java应用程序响应Mac OX X特定的Apple事件.要使用此类,请执行以下操作:

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

  • 获取Application的实例.

  • Obtain an instance of Application.

实例化一个或多个实现ApplicationListener接口的对象. (提供了一个便利类com.apple.eawt.ApplicationAdaptor.为其创建一个实例,以便在ApplicationListener接口中对事件进行默认处理.)

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.

向Application对象注册ApplicationAdaptor. "

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

也许您错过了这一部分?

Perhaps you missed this part?

出现

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
        }

    });