aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JTextField problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTextField problem" Watch "JTextField problem" New topic
Author

JTextField problem

Tejaswini Shirkhedkar
Greenhorn

Joined: Jun 22, 2004
Posts: 17
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

Joined: Jul 01, 2004
Posts: 35
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTextField problem