1 Reply Latest reply on Jan 7, 2005 4:05 PM by 807596

    Using a frame to call a frame


      I am currently writing a program where, at one point, the main program (an applet) calls another window with a popup question. The user is to answer a question (it's multiple choice, so checkboxes are used) and I would like a score value to be returned to the main applet. I have heard of things like JDialog stuff, but I wish to look for any alternative method other than anything too advanced. I was thinking of writing a value into a textfile and then reading the textfile from the main applet, however, for some reason the program freezes when this happens. If you have any suggestions as to what i can do please reply asap. Thanks
        • 1. Re: Using a frame to call a frame
          Actually, when it comes to something not too advanced, trying to use a text file probably doesn't qualify. The thing is, Java applets are executed in a sandbox inside the browser, and typically not allowed to wander around outside of it. Which means that, unless you specifically assign permissions otherwise (which qualifies as "advanced"), your applet probably doesn't have access to the user's file system.

          Much simpler would be to use a field. Now, I hate public fields, so I'd use a private field and a public accessor. A field like theAnswer, with an accessor like setTheAnswer, that your popup window calls just before it closes. That way, you don't have to step outside of the sandbox.