Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to check if entered text in textfield are all blank characters (spaces)

843806May 24 2009 — edited May 24 2009
I have a JFrame form class in which I enter data via two text fields and the type of characters that go in those fields are String. So the user can enter any combination of characters but I don't want them to be able to enter all blanks (spaces), because if I want someone to enter his name he must enter name consisting of at least one letter character.

Can someone explain to me how to achieve this, or to be more precise, how to check all entered characters in the text field and display message if all entered are spaces?

Thank You.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 21 2009
Added on May 24 2009
4 comments
542 views