public static void setFileHandler ( Object target , Method fileHandler ) { setHandler ( new OSXAdapter ( "handleOpenFile" , target , fileHandler ) { // Override OSXAdapter.callTarget to send information on the // file to be opened public boolean callTarget ( Object appleEvent ) { if ( appleEvent != null ) { try { Method getFilenameMethod = appleEvent . getClass ( ) . getDeclaredMethod ( "getFilename" , ( Class [ ] ) null ) ; String filename = ( String ) getFilenameMethod . invoke ( appleEvent , ( Object [ ] ) null ) ; this . targetMethod . invoke ( this . targetObject , new Object [ ] { filename } ) ; } catch ( Exception ex ) { } } return true ; } } ) ; }
application bundle s Info . plist