• Post Reply Bookmark Topic Watch Topic
  • New Topic

Number of charecters in JTextField

 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to control Number of charecters in JTextField (EX:8 in case of date(12-02-04))
 
Lalit K Kumar
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I think jFormattedTextField will be most suitable for you. you can set the maximum characters,minimum characters and even apply masking to your text field (as in your case. you wish the user to enter in specified format
XX-XX-XX). the details about it can be found in javadocs.
If you still wish to use jTextField, then you will have to do it programatically. After the user enters in some value, check out for your specified format and set the focus again to this textfield if it is not in your format.
Mail back for any confusion
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!