• Post Reply Bookmark Topic Watch Topic
  • New Topic

Are there any framework to validate the value of a textfield?  RSS feed

 
alex han
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
like html form ,GUI need to validate whether the infomation that user inputed are available or not,such as sometimes textfield could't null, sometimes must input number and so on.

are there a comon framework to finish this work, instead of write listener for every textfiled in GUI?

many thanks
 
Alex Kravets
Ranch Hand
Posts: 476
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure what you mean by framework, but I just create a class that extends from a JTextField and validate my input there:


This will allow only numbers to be entered.

Hope this helps,
Alex
 
Don Kiddick
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
or if using 1.4 or upwards you can use the JFormattedTextField class
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!