• Post Reply Bookmark Topic Watch Topic
  • New Topic

using Regex and JFormattedTextfields - need help  RSS feed

 
chad stevens
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your reply, I have looked on that newletter, my problem lies in the passing of the formatter to the JFormattedTextfield. If I pass it as follows:
new JFormattedTextField(new RegexFormatter(myForm)
then, does it validate as the user types in text, or other checks are required if focus is lost? If so, how to check this? Thank you again. Any suggestions would be helpful to me in solving my problem.
[ October 06, 2002: Message edited by: chad stevens ]
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the JavaRanch Newsletter last month An Introduction to java.util.regex - Lesson 1 .
 
chad stevens
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your reply, I have looked on that newletter, my problem lies in the passing of the formatter to the JFormattedTextfield. If I pass it as follows:
new JFormattedTextField(new RegexFormatter(myForm)
then, does it validate as the user types in text, or other checks are required if focus is lost? If so, how to check this? Thank you again. Any suggestions would be helpful to me in solving my problem.
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Swing forum.
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want the contents of the JTextField to be edited you need to put a listener on the TextField and every time that a character is entered you need to have the listener apply some logic (which my include a use of regex) to the text.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!