I assume that you are the one who wrote the entire code, otherwise you have
to start digging into it. I certainly do not suggest that you should publish
your _entire_ code for the sake of someone analyzing it and finding the
problem. Not many readers will have time or desire for such an exercise.
Instead, I would suggest that you put together a very simplistic test case,
that would replicate the part of program that causes trouble, namely a
JFrame with JMenu in it (populated with the JMenuItems that instantiate the
dialog), and the skeleton code for the dialog. Try it and see if the the
disalog is still instantiated, even though you don't understand the
mechanics of it. If the dialog _does not_ get instantiated, start working
your way up, adding the functionality back to your code, bringing it
gradually to its original state, and see at what point it begins working
again.
If the dialog still gets created, and you are still at loss at what actually
instantiates it, post this stripped-down code.
Without seeing even the skeleton sample of the code, I can only suggest that
your JMenuItems must have an action listener assigned to them somewhere, and
the action listener creates the dialog. Look for the
actionPerformed(ActionEvent e) method in your code.
Alex.
> Posting my code is something of a problem because of confidentiality
> concerns. I could construct an example that illustrates the point without
[quoted text clipped - 93 lines]
> > > make it so complicated that there are no obvious deficiencies." - C.A.R.
> > > Hoare
Rhino - 14 Feb 2005 14:18 GMT
Thanks for your suggestions, Alex, but I've figured out my problem.
Something you said in your second reply got me thinking along the right
track and a minute with the debugger removed the fog: the path the program
takes is exactly the same as if the user clicked the menu options
themselves. I knew that conceptually before but now I've digested it and the
whole thing makes sense now. The simulated 'Change Preferences' click took
me into my logic for handling a 'Change Preferences' click in the GUI's
actionPerformed, just as it should. And there, of course, was my
instantiation of my Preferences dialog and a reference to that dialog.
There never was a problem except that I hadn't really digested the fact that
the doClick() caused me to go to the 'Change Preferences' logic. Somehow, I
had it in my head that some kind of strange magic was going on and the
Preferences dialog was getting created "under the covers" somehow. It was
silly but that's life; sometimes the penny doesn't drop quite as readily as
it should ;-)
Thanks for your suggestions in this matter!
By the way, I've figured out a better way to do what I want to do that
doesn't involve the dubious design that I first conceived. The doClick()
approach really was a shoddy approach, as you noted.
Rhino
> I assume that you are the one who wrote the entire code, otherwise you have
> to start digging into it. I certainly do not suggest that you should publish
[quoted text clipped - 136 lines]
> C.A.R.
> > > > Hoare