• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Closing client

 
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure how to handle this one. I have in my connection object, written code that releases all locks when a user exits the gui from the Exit item on my menu( I used the body of the close() method). However my frame uses DefaultCloseOperation and exits without releasing the locks.
I don't want to add a WindowListener and implement the same functionality which my controller handles in my view object. Please give me some advice on this one.
It is the fact that windowListener creates a WindowAdapter that is confusing. How do we seperate them into MVC pattern?
 
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use the same WindowListener for both Exit JMenuItem and closing Action the JFrame
 
Nigel Browne
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes but how do I add the window listener to my controller and reference it from my view ?
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

reference it from my view ?


Why would your view need this information. Your controller should have a reference of your GUI, which hooks the WindowListener into GUI's action.
Mark
 
The only cure for that is hours of television radiation. And this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic