Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Use mask formatter in conjunction with a DateFormatter in Swing

 
Theodore David Williams
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a date field in a swing gui and the user would like not to have to enter the '/' 's between the date and the ':' ' s between the time.

If I use a JFormattedTextField with a date formatter i.e.

Then I have the ability to format date correctly but I have to enter the "/' 's and the ":" 's maunally

If I use a FormattedTextField with a MaskFormatter i.e.


Now the user will not have to enter /'s or :'s but I imagine that I lose some of what the date formatter will give me right?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic