Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Focus + Validation + enabled/disabled fields

 
Eberson Oliveira
Greenhorn
Posts: 4
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Sorry for my English.

I have two consecutive fields (order and supplier). According to my system the first one will be enabled and the second one will be disabled.
I have a InputVerifier that if the first field value is ok the second field will turn enabled.
However, the focus should go from the first field to the second field (after the validation of the first field have been performed and change it to enabled).
My problem is when the first field lost a focus the second field is not elected because it still is disabled.
I think about trying to call my validation prior to loss of focus to solve it, but I don't know if is a good solution...
Anyone have any idea to solve my problem?

Thanks to all...

Éberson
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Instead of disabling the field, you can try making it uneditable.
 
Eberson Oliveira
Greenhorn
Posts: 4
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much.

I will try your solution today and post back my results.

Thanks,
Éberson
 
Greg Brannon
Bartender
Posts: 563
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eberson Oliveira wrote:My problem is when the first field lost a focus the second field is not elected because it still is disabled.


Or, the logic that causes a component to lose focus could be used to first enable the other component before the focus attempts to shift to the other component.
 
Eberson Oliveira
Greenhorn
Posts: 4
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought about it, but that is a Java process. I only wrote a FocusTransversalPolicy and a InputVerifier... the rest is with de standard java process.

The fields are enabled in the end of the my InputVerifier.

I thought of interfering, but I don't know if it's a good solution or if exists another better solution. So, I came here ask for you.
 
Greg Brannon
Bartender
Posts: 563
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, you're over my head. I probably 'spoke' when I should have stuck to listening.
 
Eberson Oliveira
Greenhorn
Posts: 4
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:
Instead of disabling the field, you can try making it uneditable.


This solution didn't solve my problem. When I tried solve with your solution, the problem changed of location.

I solved this problem intercepting the transferFocus and the transferFocusBackward methods and invoking the validation process, but I don't now if this is a good solution.
 
Paper has not yet been outlawed – so let your Java Swing application print with wild abandon: JPDF
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!