• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTextField Validation  RSS feed

 
Qunfeng Wang
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I used to do this by just poping up a warning dialog when an OK button is pressed.I've read some articles about Document, it seems there is a better way to do text validations.Now I give you some requests below, I'd like to listen your suggestions on it, and then I'll implement it. If someone has already done this work, please give me the link you know.

1.Can set a max length.
2.Can input different patterns, for example numbers, characters...
3.For number input can set a max value.

Thanks in advance.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this link should provide most of the answers to your questions

http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!