This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Applets and the fly likes I only want one instance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "I only want one instance" Watch "I only want one instance" New topic
Author

I only want one instance

Tharpa Roberts
Greenhorn

Joined: Jun 04, 2014
Posts: 1
Here's the situation before I inherited the project: There was an applet with a browse button. There was also another button that was not part of the applet. Clicking on the button launched a process with the selected path as a parameter.

Here's the situation now: I added a set of radio buttons to the applet. Selecting a radio button populates a variable with the selection. However, I have discovered that clicking on the button now launches another instance of the applet, so that the radio selection is not preserved.

What is the best and shortest way to preserve the value of the original selection?
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2332
    
  50
Welcome to the Ranch.

If you want values to persist when the page refreshes then you need to keep a record of the values whenever they are changed and read in these recorded values when the new applet instance loads. You may want to keep record the current date and time as well so you don't load out of date values eg from a session several hours/days ago.

I've never done this before but I think you could do it with cookies. There's a thread here that may get you started.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I only want one instance