Sand-boxed or trusted? Deployed using standard HTML or JNLP?
¿How can I do to, by clicking a button, download a file?
Is it the 'clicking a button' or the 'download a file'
that you are having trouble with?
At the same site or a different site?
¿And if the file is in a resource?
You mean if it is in one of the Jars added the run-time
class-path of the applet using the 'archive' attribute?
That makes it simpler.
BTW - never ignore the possibility of putting a simple
HTML link to the (un-Jar'd) resource on the server, and
ensure the server has the correct mime-type configured
for that file type. Most browser/OS combos. will know
exactly what to do with/how to handle most file types
that might be downloaded.
BTW (2) - What is the type of files you want to offer
the user on the 'click of a button'? Images? Music?
Viruses? ..