File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes jFormattedTextField issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "jFormattedTextField issue" Watch "jFormattedTextField issue" New topic

jFormattedTextField issue

Seema Sharma
Ranch Hand

Joined: May 24, 2007
Posts: 78
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,
Rob Spoor

Joined: Oct 27, 2005
Posts: 20271

Use a DocumentListener.

How To Ask Questions How To Answer Questions
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
I would use a DocumentFilter for this.
Seema Sharma
Ranch Hand

Joined: May 24, 2007
Posts: 78
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.


I agree. Here's the link:
subject: jFormattedTextField issue
It's not a secret anymore!