• 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

Cancelling events

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I was wondering if it is possible to cancel the events that exist on the event dispatching thread.
On my GUI i have a JTree and on adding a new node to the tree i want to validate some data before the user leaves this new node. So what i have done is add some checks in the TreeListener value changed method which do the check when the user selects a new node.
It is also possible that the user may decide to select one of the menu options and close the application which would mean that the check would never be carried out. SO what i have done is add a focusListener to the tree. On the focusLost event i can then do the necessary validation. However if this validation falis i wish to cancel the menu selection event and just leave the focus on the tree node that is selected. Is is possible to cancel events in this way?
thanks,
John
 
reply
    Bookmark Topic Watch Topic
  • New Topic