Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

problem with focus listener  RSS feed

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I registered focus lisener on JTextField. The listener getting called 2 times during 'TAB' out.
Why does Focus Lost event gets called twice for all the JTextFields ??

I want to do some valiadtion on 'TAB' out of JTextField?
Is there any alternative for this?

Please advise ..

Thanks in advance
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try printing all the focus listeners, see if somehow the same listener gets added twice.
i used the same approach to detect tab out, it only gets called once
 
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by jyothi ve:
I registered focus lisener on JTextField. The listener getting called 2 times during 'TAB' out.
Why does Focus Lost event gets called twice for all the JTextFields ??



Make sure the listener is added only once in the constructor... If ur code contains some other manipulation on the listeners added to the JTextField, I do suggest you to have a look carefully at those code...

Or you might want to provide us with a part of your code so that we can help you more...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!