Yo!
Same problem is addressed with the finalize() discussion in the Effective Java by Joshua Bloch.
He recommends not overriding the super.finalize(), because it is executed on a separate, "lazy" thread. I do not have enough AWT/Swing, but I wonder if it is the same case with dispose()?
Instead, Bloch suggests having a separate method, called cleanUp() or something like that, that performs all the clean-up/resource release tasks you need to do. You can call the cleanUp() method explicitly, and THEN call the super.finalize()/super.dispose() (or wait for VM to call it).
This makes your code also super-clear on what you intend to do, so it is a good design policy.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 01, 2002 11:01 PM
To: JDJList
Subject: [jdjlist] Re: IllegalStateException caused by Over-riding
dispose
> I have since found that it only seems to blow up if a JComboBox is the
> focus when the window is closed. If I click on the exit button no problem.
But if
> I close by clicking the Window close box and the focus happens to be in a
> JComboBox I get the error.
interesting... perhaps you can move the focus explicitely to some "riskless"
component prior to calling dispose()
> Also I have read the quote from the jdk doc many times and find it
> misleading. The native resources may be released but the memory of all
> the components does not appear to be released unless you remove the
components
> from the container and you are usually successful then only if there are
> no listeners or you remove the listeners (at least on 1.3.1 and prior,
don't
> know about 1.4).
I find that very misleading too. in fact I relied on that up to this time
and did not
realize that the components are not collected. but I never had an app with
that
many windows. please post your solution if you should find a good one.
thanks & greets
--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net
To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm
http://www.sys-con.com/java/list.cfm
