• Post Reply Bookmark Topic Watch Topic
  • New Topic

Edit Close(x) Button JFrame  RSS feed

 
Jeff Zak
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to edit the functionality of the close(x) button on the JFrame? I have two places to close my program. One is in my File Menu that displays a nice message saying "All unsaved data will be lost if you proceed" YES/NO. This works great but I'd also prefer this when Close(x) is pressed as well since that closes without the prompt.
 
Rob Camick
Ranch Hand
Posts: 2756
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out Closing an Application.

It shows how to create an Acton that can be shared by the closing of the frame and a menu item.
 
Jeff Zak
Greenhorn
Posts: 23
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
Good info elsewhere on the blog, too.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!