• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

multiple events on a single control

 
Ranch Hand
Posts: 176
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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


FXML Code


 
Sheriff
Posts: 6029
157
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's hard to tell with just these snippets, but I think you need a Login button.
 
John Morgan
Ranch Hand
Posts: 176
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The idea is that the controller will check to ensure that the field is not blank and does not contain a number before the user logs in, so when they leave the control (login textfield or password field) a check is done before they can proceed.
 
Knute Snortum
Sheriff
Posts: 6029
157
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But when you leave the username field to go to the password field, you will get a warning.
 
John Morgan
Ranch Hand
Posts: 176
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is what is not working... When I tab out of the username field or click out the warning does not come up, however if I hit enter and then tab the warning comes up.
 
Knute Snortum
Sheriff
Posts: 6029
157
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a (not so) minimal example of how to use gaining and losing focus to know when to login.  The problem I have -- and I don't know how to fix it -- is that you get a warning when you tab from the username to the password before you get a chance to enter it.  That is why I recommended using a login button.
 
John Morgan
Ranch Hand
Posts: 176
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you... I worked on this more yesterday and this morning and finally admitted defeat for the time being and added in a login button and got everything to work.

Now onto the next problem.  
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!