Java应用程序不知道要打开的文件的名称- Mac OS X

时间:2022-03-29 09:34:39

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.

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

1 个解决方案

#1


1  

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.

我认为您必须实现ApplicationListener或扩展ApplicationAdapter并实现handleOpenFile()方法。请参阅http://to.java.net/pub/a/today/2004/01/05/swing.html以获得更详细的解释。

#1


1  

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.

我认为您必须实现ApplicationListener或扩展ApplicationAdapter并实现handleOpenFile()方法。请参阅http://to.java.net/pub/a/today/2004/01/05/swing.html以获得更详细的解释。