How can I create an uneditable date formatted (00/00/0000) textfield in JAVA, which allows user to type only numbers

Numbers allowed in the first offset - 0-3
Numbers allowed in the second offset - 0-9
"/" in the third offset should not be deleted
Numbers allowed in the fourth offset - 0,1
Numbers allowed in the fifth offset - 0-9
"/" in the sixth offset should not be deleted
Number allowed in the seventh offset - 2
Number allowed in the eighth offset - 0
Number allowed in the ninth offset - 0
Numbers allowed in the tenth offset - 6-9

textfield MUST not allow the user to delete both zero and slash(/)

Need Urgent help....
:sad:

Member Avatar for iamthwee

>How can I create an uneditable date formatted (00/00/0000) textfield in JAVA, which allows user to type only numbers...

I'm not sure whether you could do that immediately at the time the users types in the date. This is just a guess. I'm probably be proved wrong yet again :lol:.


However, you could introduce a submit button, which would then parse the input the user has entered and return a success message if the input satisfies your criteria.

Of course you can. Add a KeyListener which rejects all non-numeric formats and inserts the slashes as needed :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.