File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cant figure this out

 
khella smith
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
u have a textfield and u only want it to take strictly alphabets as strings and u have to get the name from this field and compare it before determining if it is all alphabets cause u dont want it to take numbers.if u get the text from the textfield what do u compare it to to ensure that this condition is true and if it is false i want it to display an error message saying u are only allowed to use alphabets for this kind of field.i know how to display the message but what do i compare the name from the textfield with to ensure that the condition is true? i cant seem to figure it out
i appreciate an answer
........................
khella smith
 
Bosun Bello
Ranch Hand
Posts: 1510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the following methods of the Character class. isDigit(), isLetter(), etc. You want to loop through each character in your string and to the check you need to do. Check the API for more info.
 
Paul Stevens
Ranch Hand
Posts: 2823
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
TextField or JTextField? The solution depends on which.
 
khella smith
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its JTextField
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic