Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jFormattedTextField issue

 
Seema Sharma
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
The problem is to avoid the duplicate text of 1st jformattedtextfield to be entered in 2nd jformattedtextfield. i need to display meesage if two textfields has same text.

I am able to provide the message only when focus lost event takes places. I want to display the message as soon the duplicate text is entered in jformattedtextfield. Please help me to proceed.


.

Thanks in advance,
Seema
 
Rob Spoor
Sheriff
Pie
Posts: 20529
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a DocumentListener.
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would use a DocumentFilter for this.
 
Seema Sharma
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I have used DocumentFilter and it works.

Now my scenario is when i do data validation, navigation to other screens should not be allowed unless valid input is entered in these textfields.

My window has Jtabbedpane which has 3 tabs. Above mentioned Jformattedtextfields is available in one of the tabs. If these textfields has: Duplicate value, empty or invalid data, validation is done and message is displayed.

If one of the text field has duplicate value/empty/invalid data and cursor is still available in the textfield and one of the tab panel is selected, then the validation message is displayed on that tabbed panel.

I need to restrict navigation and display this validation message on the panel where these textfields are available.

Please help me to resolve this issue.


Regards,
Seema

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic