File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTextField problem

 
Tejaswini Shirkhedkar
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
William A White
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • 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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic