1

I'm trying to integrate a Java Applet into a primarily JS web application with lots of Dynamic HTML (using Ext.js in this case). I'd like to be able to use the applet inside a tabpanel (or equivalent layout), but when the DHTML yanks the div that the applet lives in upon switching to a new tab, the applet understandably exits. Then when switching back again, it is relaunched, thus losing any state it might have had.

Is there any good way to either keep the div around but hidden, or otherwise keep the applet alive within a DHTML heavy framework? I can also reduce the applet size to 0x0 and put it in a span if this is of any help, but it does need to be buried inside the JS framework to be managed properly.

Thanks/O

jdo
  • 255
  • 2
  • 9
  • you want to keep data of applet preserved?? – Varun Jan 27 '11 at 04:23
  • The applet is processing a real-time stream, so must not be interrupted even if it is not actively displayed. It's more than just a state/data persistence problem--if the applet dies, it's state may be irrecoverable because part of the data stream will have been missed. – jdo Feb 02 '11 at 03:52

1 Answers1

1

It is probably a better strategy to serialize the data in the applet destroy() method and reload it in the init() method.

For ways to serialize the data, see the 3 strategies outlined in How to save some config information in an Java Applet?.

Community
  • 1
  • 1
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • Thanks, that might be a good work around in general. In this particular case, the applet is a real-time network application, so much of its 'state' is external and cannot be easily serialized without modifying corresponding server code to accommodate it. The second issue is launch time: it takes about 8 seconds to start up from cached files, so even if state could be captured completely, the user experience would be harmed. – jdo Jan 27 '11 at 17:36