Java应用程序不知道要打开的文件的名称-Mac OS X [英] Java application doesn't know name of file being opened - Mac OS X

查看:152
本文介绍了Java应用程序不知道要打开的文件的名称-Mac OS X的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个应用程序捆绑包中有一个Java应用程序,该应用程序捆绑有一个文件关联(使用Info.plist),该关联在双击文档时运行.如何获取在Java应用程序中双击过的文档的文件名?现在,我的Java应用程序正在运行,并显示一个空文档.似乎没有任何命令行参数传递给应用程序.

I have a Java application in an application bundle that has a file association (using Info.plist) that runs when a document is double-clicked. How do I get the filename of the document that was double-clicked in my Java application? Right now my Java app just runs and displays an empty document. There doesn't seem to be any command line arguments passed to the application.

推荐答案

我认为您必须实现 http://today.java.net/pub/a/today/2004/01/05/swing.html 进行更详细的说明.

I think you have to implement ApplicationListener or extend ApplicationAdapter and implement the handleOpenFile() method. See http://today.java.net/pub/a/today/2004/01/05/swing.html for a more elaborate explanation.

这篇关于Java应用程序不知道要打开的文件的名称-Mac OS X的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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