1- I wanna dedect when tab key is pressed or typed or released. i tried ;
I dont even get the first message when i type tab key. Its moving to another focusable component and seems No Keyevent fired.
How can i dedect if tabkey is typed?
2-When its typed i want it's function not to be performed. I mean it should not go to next focusable field. But i want to dedect it when its typed.Because i want to make some operations suc as jdbc and after that either i am going to send the cursor to next focusable field or another one or in case of failure of a select sql , i wont permit the user pass the field which is tabkey pressed.
User must not move to another field without entering a valid value that is existing in db table..
It sounds like you want the contents of a field to be verified when the user tries to shift focus off that field. That is a job for InputVerifier. Since focus management grabs tab key events they never make it to the text field. And as a rule of thumb I suggest that you shouldn't write KeyListeners -- they are almost always wrong, or there is a better solution not involving them.
There is no emoticon for what I am feeling!
Joined: Jul 15, 2005
Thank you for answer. However How can i manage the focusing after the textfield is verified? Cursor is moving to next focusable component. I also want to manage its movement.And some other operations..
I imagine it to be like this,
User is going to hit the tab key, and secondly it will connect to an application server.App. server is going to run an sql statement and will return the results in form of text documents such as ;
focus [component_name] visible [component_name] enable[component_name] or setValue[component_name,value]
And after that i will get the results and process with a parser.. If not any movement exists cursor will not go anywhere either..
its like this..
[ February 23, 2006: Message edited by: sinasi susam ] [ February 23, 2006: Message edited by: sinasi susam ]
Joined: Jun 09, 2003
see if this gets you what you want
Joined: Jan 16, 2006
You have to implement KeyLitener interface and implement the overridden methods void keyTyped(), void keyPressed(), void keyRelease() methods