🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #1834

Special mask for JFormattedTextField

#1834
From: Rogier
Date: Thu, 07 Aug 2003 07:49
39 lines
1972 bytes
Hi,

I got a problem to create a special mask for a JFormattedTextField. I
got the follwing code:

    mask = new MaskFormatter();
    mask.setValidCharacters("0123456789.");
    try
    {
      mask.setMask("???#");
    }
    catch (ParseException ex1)
    {
    }

    component = new JFormattedTextField(mask);

But this is not how it should work. I want to build in the following
restriction for the characters:

* Maximum of characters is 4
* First character must be a digit or a dot
* Second character must be a digit if the first character is a dot.
Otherwise it may be a digit or a dot.
* Third character must be a digit if the second character is a dot.
Otherwise it may be a digit or a dot.
* Forth character must be a digit
* When a dot is used, there may only be one character putted in after
it and must be a 5
* The value in this JFormattedTextField may variate from empty to
9999, which means that the value can contain 1, 2, 3 or 4 characters.

Is it possible to set restrictions for just one charcater, so that I
can build in above mentioned restrictions?

I hope someone can help me out here,

thnx in advance
Rogier
Technical Details
Message-ID: <e67ce7c9.0308062349.1b09cc8@posting.google.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,52349be5e9828dcb,start
X-Google-Attributes: gid111d45,public
X-Google-ArrivalTime: 2003-08-07 00:49:04 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail
From: necrulez@hotmail.com (Rogier)
Newsgroups: borland.public.jbuilder.java.swing
Subject: Special mask for JFormattedTextField
Date: 7 Aug 2003 00:49:02 -0700
Organization: http://groups.google.com/
Lines: 39
Message-ID: <e67ce7c9.0308062349.1b09cc8@posting.google.com>
NNTP-Posting-Host: 80.127.195.18
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1060242543 24159 127.0.0.1 (7 Aug 2003 07:49:03 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: 7 Aug 2003 07:49:03 GMT