Static Swing components get GC between pages?

I am trying to keep a complex JFrame with many subcomponents as a static variable in my JApplet. Basically I have a static field in my applet, which contains a reference to the fully created JFrame, which is initialized the first time my applet is loaded in a new JVM (in a new browser).

The applet is loaded on many different pages, and the goal is that everytime a new page is loaded the new applet simply reuses the previously initialized JFrame, using the static field, without going through the whole process of creating them again.

The problem is with the JRE 1.4 (any 1.4.* version I think) in Internet Explorer 6 :

the first time the applet is loaded, the JFrame is created, and then showed fine. If I use the javaScript to open the JFrame again in the same page, it is shown fine again. BUT, if I go to a different page which loads the applet, the JFrame is reused and opens, but the content of the frame is completely blank, and completely useless!

I have tried using a JDialog in the same way, with the same JPanel inside that I used in the contentPane of my JFrame, and the problem is the same, with the exception that the applet is not completely blank, : you can see some of the components, but they are dead, and do not react (i.e texfields are not focusable, comboboxes do not react to click, etc...)

What could be the problem? This does not generate any exceptions at all, the JFrame/JDialog is simply dead, and I cannot re-use it.

Could it be something with the GC? Like the UI peers are discarded when the applet's page is unloaded, even though there are still references to them in the JVM?

This problem does not occur in Safari on Mac.

Thanks for any help/ideas you might have, I googled and searched the forums to no avail.

[1804 byte] By [OliNether] at [2007-9-30 21:32:56]
# 1

One little correction:

After some more tests I can say that this is related to the version of the SUN JVM, because the problem is not present in the JRE 1.4.0_01. I just tested.

The behaviour seems to have changed quite a bit since 1.4.0, because in 1.4.0 a JFrame opened from a JApplet can continue to live even when you change the webpage in your browser to a page that doesn't have the applet. In the 1.4.2 where I tested it, any JFrame is forcedly closed when you switch to a different page, and then the bug I describe in my previous post occurs. So this is very probably related.

Stil no ideas anynone? Any spec in the JVM that would have changed? I'm lost!

OliNether at 2007-7-7 3:04:28 > top of Java-index,Desktop,Core GUI APIs...