Java OS X Lion关于菜单 [英] Java OS X Lion About Menu

查看:84
本文介绍了Java OS X Lion关于菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试覆盖OS X Lion上的Java应用程序或Leopard& amp;中的任何内容的about菜单.以上.我怎么做?到目前为止,我看过的教程似乎不是最新的,有些类不再在Java Mac SDK中出现,而其他事件则不会触发.

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.

提前谢谢!

推荐答案

您可能会在

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
        }

    });

这篇关于Java OS X Lion关于菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆