Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: handleOpenFile is not called



Leila Rhaouti wrote:

>I was able to listen to all the events such as handleAbout, handleQuit,
>etc.. However the the handleOpenFile event never seems to get called when
>double-clicking on a file that is associated with my application. The
>application opens but the handleOpenFile doesn't get called.

Try dropping the file from the Finder onto its app-icon in the Dock.
Does that work or not?


>Basically, this is the way that I'm implementing the ApplicationListener
>...
>public void handleOpenFile(ActionEvent e)
>{
>   System.out.println("Handle OpenFile");
>}

This method will never be called, because Application doesn't send ActionEvent's
to ApplicationListeners.  It sends ApplicationEvent's.

None of your other methods will ever be called either, for the same reason.

<http://developer.apple.com/documentation/Java/Reference/1.5.0/appledoc/api/com/apple/eawt/ApplicationListener.html>

Either you didn't copy and paste the real code you have in your source
file, or your class doesn't really implement ApplicationListener.

When posting examples, you should post the actual code, not something you
made up without having compiled it first.  

If the code you posted is really the code you compiled and ran, then it
doesn't actually implement ApplicationListener.  I would expect that to not
compile, but since you left out other things in your post (like {}'s), I
don't know what you compiled and ran that didn't work.


>The application was packaged using JarBundler to created a dmg file.

JarBundler.app doesn't create dmg files.  Or are you referring to the
JarBundler Ant task (which can), and not JarBundler.app distributed by Apple?

Also, JarBundler.app will not, by default, create the Info.plist keys
needed to bind a file-suffix to an application.  I don't know about the
JarBundler Ant task, but I think it only puts into Info.plist what you give it.

  -- GG


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.