This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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
Just a guess here, but try and Not sure how you declared view but my GUI extends JFrame.
Joined: Jan 14, 2007
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.