• Post Reply Bookmark Topic Watch Topic
  • New Topic

Ugly spacing with MaskFormatter  RSS feed

 
Larry Krigbaum
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using the MaskFormatter for some simple input, but I don't care for the way it looks. The code I'm using is basically just...

iddob_field = new JFormattedTextField(new MaskFormatter("##/##/####"));

When the empty text field first appears on the screen, it only uses one space between the slashes instead of two, as in instead of . Is there anyway to change that behavior?

Thanks for any suggestions.

 
Campbell Ritchie
Marshal
Posts: 56529
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

You can't see the different spacing without code tags, so I added tags to your post.
 
Campbell Ritchie
Marshal
Posts: 56529
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I notice MaskFormatter doesn't seem to recognise whitespace as a character type.

Is the placeholder character any use to you? I am just guessing.
 
Larry Krigbaum
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for adding the tags. I obviously have multiple formatting challenges...

As for the placeholder, in my experimenting, it just seems to add another unwanted appearance problem as it wants to show up on the screen so it doesn't seem to help in this case. Thanks for the suggestion, though. I'll keep working with it and the other options.


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!