• Post Reply Bookmark Topic Watch Topic
  • New Topic

Right Click Menu for JFrame in Windows Taskbar  RSS feed

 
Chris Simpkins
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am designing an application that has an undecorated frame as its main frame and I need for a number of tasks to be completed prior to exiting the application. These methods are included in an inner class that is added as an actionListener on an exit button that i've added to the image. The problem is that these exits methods are all skipped if the user uses the Windows taskbar right click menu to close the application. Is it possible to add my action handler to this or can I disable this right click menu in the taskbar?

Thanks,
Chris
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you could add a windowListener (for windowClosing) and
1) include a button.doClick(); or
2) put the code from the actionPerformed() into a separate method, and
have this called from both actionPerformed() and windowClosing()

something like this
(my preference would always be for (2))


 
Chris Simpkins
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply Michael. It worked!

Thanks again,
-Chris
[ September 28, 2005: Message edited by: Chris Simpkins ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!