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
William A White
posted 11 years ago
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.