• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DefaultCloseOperation on Jdialog not working as expected

 
Robert McDonald
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I recently changed around my window flow from a config jframe opening up the client window jframe to a client jframe which first opens a config jdialog window. Everything is working fine apart from the close window on the jdialog. I have setDefaultCloseOperation(JDialog.EXIT_ON_CLOSE); in the dialog constructor but if you use the window controls to close 'click the x' then it just doesn't do anything.

If i change it to setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE) then the the x works but then this results in the Client jframe continuing to open erroneously. I have an exit button on the config but i'd like to know why this doesn't appear to work and what can be done to correct it.

Should i have kept them both as JFrames?

Robert
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12007
215
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Robert,

Do you feel like posting a very small sample application that demonstrates your problem?

Regards, Andrew
 
Robert McDonald
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I managed to resolve this but am still not really sure what was originally wrong with the code.
I changed it to:


i.e. i added the window listener and got that to exit the system.

The original code was just:


I thought both these methods would do the same thing.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic