multiple events on a single control

Working with a login control (username and password) I can press enter on the control and then tab (without entering anything) and I get the warning that says to enter a valid user name. This is the desired effect, however if I just tab or click out of the field the event does not trigger, nor does the cursor move to the next field if the user enters a username and just presses enter.  Any suggestions?

Controller Code

void getUserName(ActionEvent event) {

userName.focusedProperty().addListener((ov, oldV, newV) -> {

if (!(userName.getText().isEmpty())) {

if (!newV) {

String textUserValue =...

Read More »

By: coderanch.comforumsrssforumTopics98JavaFX - Monday, 16 April

Related Posts