Java - set boolean to false if JTextField is selected

Johnatan56

Honorary Master
Joined
Aug 23, 2013
Messages
30,955
Hi,

I am trying to design a UI whereby the main point is that it can be operated by touch.
I want to be able to select the top field, if selected set variable value to x, can type on the numpad. click on field2 and variable value changes to y, so the numpad will perform the check and add the characters to the second field.
example.png
My second option would be to change the enter key to "change to username" and swap that to "change to password".

It's a mini uni project, an extra feature I'd like to add for a login screen.

EDIT: forgot to post this, just for anyone else interested and maybe get some google searches, lol, use jswingitemMouseClicked(MouseEvent evt){} , jswingitem in my case was JFormattedTextField.
 

xumwun

Expert Member
Joined
Jul 30, 2006
Messages
3,151
The textbox should have a focus event. Set your variable depending on which textbox triggers the focus event.
 
Top