- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 CFBundleDocumentTypes 将自定义文件扩展名与我的应用程序关联。据我所知,这似乎“有效”——当我双击该文件时,JavaApplicationStub 会启动我的应用程序。但是,没有通过我在 java 中设置的 ApplicationListener 事件注册回调。
我使用了 Set Default file association Mac OS X Java Package Maker Installer 中列出的代码进行文件关联,文件关联本身看起来很好,但似乎是应用程序 stub 试图启动文件,因此失败。
我将 Apple ApplicatinListener 代码添加到我的 java 应用程序中(类似于 http://developer.apple.com/mac/library/documentation/Java/Reference/1.5.0/appledoc/api/index.html?com/apple/eawt/Application.html ),但我的应用程序似乎没有收到回调。
代码类似于
Application.getApplication().addApplicationListener(
new ApplicationAdapter() {
public void handleOpenFile(ApplicationEvent evt) {
//some logging message here that I never get
}
}
);
我也许应该提到我也在使用 SWT...
如有任何帮助,我们将不胜感激
最佳答案
遗憾的是,您无法同时使用 SWT 和 eAWT 的 ApplicationListener。看这个SWT bug 。 SWT 需要 Apple 在 JVM 中进行更改,然后我必须更改 SWT 才能使用它。
由于您对打开文件事件感兴趣,因此您现在可以在所有平台上完全在 SWT 中执行此操作。在 3.6 SWT 中,有一个新事件 SWT.OpenDocument
,当双击应用程序的文件时将触发该事件。看这个blog post并搜索“SWT.OpenDocument”。
关于带有 CFBundleDocumentTypes 的 JavaApplicationStub,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3033948/
我正在尝试使用 CFBundleDocumentTypes 将自定义文件扩展名与我的应用程序关联。据我所知,这似乎“有效”——当我双击该文件时,JavaApplicationStub 会启动我的应用程
我在 Eclipse 中创建了一个使用 SWT 作为 GUI 的应用程序。我尝试使用 Eclipse 部署来部署应用程序,但似乎当我这样做时,LSUIElement 不受尊重,我无法强制应用程序从停靠
我维护了一个 Mac 版 Java 应用程序,该应用程序是在 PPC 时代编写的,它的用户很高兴在 Rosetta 下运行它,直到他升级到 lion。我们尝试在应用程序文件夹中切换 JavaAppli
我正在开发一个带有 native 可执行文件的跨平台 Java 应用程序。对于 Mac OS X,我使用 Jarbundler作为创建应用程序包的 ANT 任务。 现在 Oracle 发布了 Java
我是一名优秀的程序员,十分优秀!