• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Right Click Menu for JFrame in Windows Taskbar

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply Michael. It worked!

Thanks again,
-Chris
[ September 28, 2005: Message edited by: Chris Simpkins ]
 
A magnificient life is loaded with tough challenges. En garde tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic