• 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

JTextField problem

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am designing a GUI with JDBC.
There is a field called Logical Address, that is to be entered by the user.
When user enters this value, my program should consult the database and get required information.
How do I handle when user has typed in the characters?
I have thought about some options like
1 use focusGained() and focusLost() methods
2 use keyPressed event

Please suggest the solution.
Thanks

Teju
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think what you mean is that you want the user to type an address in a field, and then your application will populate other fields with associated information from the database.

In that case I guess I would use onFocusLost, and if you wanted to you could use the keyPressed events to do a kind of autocompletion.

I think that if the logical addresses are stored in the database anyways, and there aren't a large number, it would be better to have a dropdown or list that already has the addresses to choose from.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic