hi, I need some help about this user entry phase of my program (password prompting)
I'm having some problem regarding with the keyboard press with my jbutton inside the frame.
I dont have any problems with the keyboard event.. but the problem is in the "focus"(i dont know if that is the best word to express the problem),
anyway the problem is, when i press the button the "focus" is starting on the text field(well ofcourse it will start on the first component), so when i press the "Enter" key, the button doesnt fire any keyboard event
i have to go through the two textfields first before i can fire the keyboard event of my button.
What I want is, even the "focus" is in either of the textfields, when i press the button it will automatically fires the keyboard event that i want...
I hope you understand my concern, sorry for bad expression of my problem(bad english) Please I desperately need some help about this. Thanks in advance!
oh sir.. how can I thank you for that one .. thats a VERY BIG help ..! thank you so much!!! thank you thank you! ... that solved my problem !! thank you!
First question is why do you want to add a action listener to a Text field? What is the functionality that you are trying to acheive by doing so.
One solution for your above issue will be to add a Key Listener to your password field and check if the pressed key is ENTER or not. If ENTER, then delegate the action to USERCONFIRMATIONBTN or call USERCONFIRMATIONBTN.doClick() as shown below
inside of the button action I added the passwordField then retrieved its generated password,
sorry for asking too much, i didnt have any idea that i can still call a different component from another action event..
Don't get me started about those stupid light bulbs.