Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / December 2003

Tip: Looking for answers? Try searching our database.

JFormattedTextField & MaskFormatter

Thread view: 
Rafal Bielec - 22 Dec 2003 21:23 GMT
Is it possible for a MaskFormatter to create a pattern that accepts one or
many digits? I know JFormattedTextField is not for matching with RegExp-like
patterns. I just want to type any numer of digits and not receive getValue()
== null if the number of digits in "###" is smaller than 3 :/.
I'm thinking of something like this, where '|' stands for "or" in this
pattern
numer = new JFormattedTextField(new MaskFormatter("#|##|###"));
Thank you for any help
Rafal Bielec - 24 Dec 2003 17:57 GMT
In case somebody had the same problem this is what i've come up so far:
DecimalFormat df = new DecimalFormat("#####");
df.setMinimumIntegerDigits(0);
df.setMaximumIntegerDigits(5);
JFormattedTextField numer = new JFormattedTextField(df);
((NumberFormatter) numer.getFormatter()).setAllowsInvalid(false);


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.