Re: Problem with initializing a class object
phillip.s.powell@gmail.com wrote:
I am trying to write a more modified version of the infamous
SimpleBrowser by allowing for the WebBrowser object property to
receive a given java.net.URL object.
You've only supplied partial code, so it's only possible to provide guesses as
to what is going wrong.
[code]
private final WebBrowser webBrowser = new WebBrowser();
What class does this code belong to, where is it's constructor being invoked?
I will attempt to guess at the problem. I think you probably have a race
condition between the thread which is executing the above constructor for
WebBrowser(), and the code below which is explicitly run on the EDT. It looks
like the code below is attempting to set the URL on the WebBrowser before it
has been properly constructed by whichever thread is constructing it.
/**
* Perform setup
*/
private void setupSimpleBrowser() {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
initObjects();
initComponents();
}
});
}
[/code]
Phil
--
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555