This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes GUI: problems with window not closed on dispose() - please help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "GUI: problems with window not closed on dispose() - please help" Watch "GUI: problems with window not closed on dispose() - please help" New topic
Author

GUI: problems with window not closed on dispose() - please help

Sigrid Kajdan
Ranch Hand

Joined: Jan 14, 2007
Posts: 72
Hi all,

as a "Swing newbie" I have serious problems with the GUI. For the details, I lean very much on the Monkhouse book, whereas for the overall design I tried to follow the Supervising Controller (or Supervising Presenter) pattern I learned about from Koskela's "Test driven" book. This means I have all action listeners in the controllers and just the pure layout in the view.

So when I start the application, I create a ConfigController, which tells the EventQueue to create the view, which opens a dialog for the confguration info. Then when the user clicks "connect", inside the ConfigController I create a new Controller, BookingController, which creates "his" view... But I cannot get the configuration window to disappear, even though I call dispose() on the view:



The configuration window just loses focus (when the table opens) and when you click it, you see it as a small distorted thing in the left corner. Does anyone perhaps have an idea what is happening here? I am hanging quite some time now with the GUI things and find them somehow much more difficult to approach than the rest

Thanks a lot in advance
Sigrid
Anne Crace
Ranch Hand

Joined: Aug 29, 2005
Posts: 223
Just a guess here, but try and Not sure how you declared view but my GUI extends JFrame.


SCJP, SCJD
Sigrid Kajdan
Ranch Hand

Joined: Jan 14, 2007
Posts: 72
Hi Anne,

thanks a lot for your answer! In fact I had both these lines in the code, but due to your suggestions I found the mistake: I was setting two "things" visible, the view and its child component, a JDialog.
(This was because inexperienced with Swing as I am, I first just set the view (a JFrame) itself visible and not the dialog, which did not work out.)
Now I have just the dialog set visible, and it seems to work fine.

Thanks again
Sigrid
 
 
subject: GUI: problems with window not closed on dispose() - please help