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

close JFrame  RSS feed

 
Manuel Paco
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Help please.
I would like my JFrame to be automatically closed when it looses focus and is minimized.
How could I accomplish that?
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you have to listen to the events "focusLost" (see the FocusListener) and "windowIconified (see WindowStateListener/WindowListener)
implement these listeners and close the window when these events occur.
don't you think the user might be astonished that the application just vanishes whenever it is deactivated (loses focus/is iconified)?
Chantal
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!