I'm creating a front end javaapplet for my website in which the user will interact with to create a theme for their windows computer. I have many simple aspects completed however there are a few things I would like to implement that I cannot seem to get working.
The first, and most important, is that I would like to download and execute a file when the user presses a button (for instance, if they wish to install a screen saver, it will download the .scr and start the user installation window). I have been told this is possible in a java applet but can't seem to find any resources describing how to carry it out.
Second, I want to be able to pass the name of a selected keyword into the applet so that it will download the appropriate file. For example, using the same hypothetical situation as above, the user searches for bunnies wallpapers, it will download a bunny wallpaper from a list of choices.
Finally, I was wondering if I would have sufficient privileges to open local windows control panel applets (.cpl) through a java applet. I haven't tried to implement this yet, but I figured while I'm here posting, someone might happen to know the answer. Basically, what I want to do it use System.run("rundll32.exe shell32.dll,Control_RunDLL themes.cpl") to pop up the user's theme window.
Thanks in advance for any help! I'll be checking back every few minutes to provide more details as is necessary.
The first and the third question sound pretty similar (unless I'm missing something). You'll need to jump out of the applet security sandbox to use Runtime.exec, but then it's possible. See HowCanAnAppletReadFilesOnTheLocalFileSystem for a description of the two principal ways to do that; I think applet signing would be the easier solution in your situation.
As to the second question, what exactly do you mean by "pass the name ... into the applet"? If the user should type it in you can use a JTextField; if she should choose it from a list, there's JList.
Ping & DNS - updated with new look and Ping home screen widget
Joined: Mar 09, 2009
Thanks for the reply! I'm working on signing my applet as we speak. For my second question, what I mean is the user is browsing a page with a bunch of download links. When the user clicks on one of the download links, it takes them to the page with the applet and then "passes" the keyword of what they want to download to the java applet. By doing this, the applet will be able to fetch the correct download from the server. Any ideas how I could do this?