A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
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?
Don't get me started about those stupid
subject: Use mask formatter in conjunction with a DateFormatter in Swing
urlyBird 1.2.3 - customer holding record
Strange behavior of the JFormattedTextField
JFormatField + MaskFormatter + AnnoyingFeature!!
MaskFormatter in JTable
setting limited number of characters for a text field
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013