Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Destroying Windows  RSS feed

 
Kejal Shah
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I've an application in which there's one main JFrame-the initial w/d. Depending on some actions, i need to pop up different JFrames from this main frame. When i close these frames i want them to be completely destroyed.
Wat happens is that if i reopen them, they hold the same text that was there before i closed them. Which means they are not completely destroyed. Is tehre some way in which i can achieve this?
Thanks in advance
 
Abhik Sarkar
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kejal,
By default, when you close a Frame/Dialog using the close button on the title bar, the window is simply hidden. To achive what you want, try:
 
VIJAY Yadlapati
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, JFrames, JInternalFrames, JDialogs are simply hidden when they are closed, as their defaultCloseOperation is HIDE_ON_CLOSE.
So you need to set the value in such a way that thay are disposed. You can use WindowConstants.DISPOSE_ON_CLOSE for intermidiate Frames/dialogs and WindowConstants.EXIT_ON_CLOSE for main JFrame.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!