A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Spring in Action
this week in the
Swing / AWT / SWT
Use mask formatter in conjunction with a DateFormatter in Swing
Theodore David Williams
Joined: Dec 21, 2009
Feb 11, 2010 10:11:28
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
with a date formatter i.e.
JFormattedTextField formattedText = new JFormattedTextField(new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"));
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
JFormattedTextField formattedText = new JFormattedTextField(new MaskFormatter("##/##/#### ##:##:##"));
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?
I agree. Here's the link:
subject: Use mask formatter in conjunction with a DateFormatter in Swing
setting limited number of characters for a text field
MaskFormatter in JTable
JFormatField + MaskFormatter + AnnoyingFeature!!
urlyBird 1.2.3 - customer holding record
Strange behavior of the JFormattedTextField
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014