简体   繁体   English

Java OS X Lion关于菜单

[英]Java OS X Lion About Menu

I am trying to override the about menu in a Java Application on OS X Lion or anything from Leopard & above. 我试图覆盖OS X Lion上的Java应用程序中的about菜单或Leopard及以上版本的任何内容。 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. 到目前为止我读过的教程似乎不是最新的,有些类不再在Java Mac SDK中,而其他的事件也没有被触发,唉。

Thanks in advance! 提前致谢!

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. 如果您使用maven作为http://developer.apple.com/library/mac/documentation/上的基础Apple说明,您可能会在http://simplericity.com/2007/10/02/1191336060000.html上找到相关说明。 Java / Reference / 1.5.0 / appledoc / api / index.html也需要在非Apple JDK上可靠地使用反射。

"This class permits your Java application to respond Mac OX X-specific Apple events. To use this class: “此类允许您的Java应用程序响应特定于Mac OX X的Apple事件。要使用此类:

  • Obtain an instance of Application. 获取应用程序的实例。

  • Instantiate one or more objects that implement the ApplicationListener interface. 实例化一个或多个实现ApplicationListener接口的对象。 (A convenience class, com.apple.eawt.ApplicationAdaptor, is provided. Create an instance of it for default handling of the events in the ApplicationListener interface). (提供了一个便利类com.apple.eawt.ApplicationAdaptor。为ApplicationListener接口中的事件的默认处理创建它的实例)。

  • Implement handlers for the appropriate events. 为适当的事件实现处理程序。

  • Register the ApplicationAdaptor(s) with the Application object. 使用Application对象注册ApplicationAdaptor。 "

Perhaps you missed this part? 也许你错过了这部分?


EDIT: It appears this was seriously changed in 10.6 update 3 and 10.5 update 8 . 编辑:看来这在10.6更新3和10.5更新8中发生了严重变化 Show a normal Java dialogue box inside the handler in 在处理程序中显示一个普通的Java对话框

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

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

    });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM