• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cancelling events  RSS feed

John Ryan
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • 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?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!