🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Using MaskFormatter - flexible field length?

#423
From: Magnus
Date: Fri, 06 May 2005 16:29
23 lines
1902 bytes
Hi,

I read "Using MaskFormatter" @ 
http://java.sun.com/docs/books/tutorial/uiswing/components/formattedtextfield.html

I like that the cursor is kept within "valid lengths" so that users 
can't put in Aaaaaaaaaaaaaaaaaaaaaaaaaa in a VARCHAR(10) field.
I know this can be validated afterwards though.

I have 2 questions:

1) I have a ZipCode field but sometimes Zip can be 9 long so I put my 
mask to "#########". Now 9 digits must be filled in. How can this be 
made so 0 to 9 digits is acceptable?

2) For a string field, mask "****" the TextField is padded with right 
spaces (" "). Upon clicking in a field like that the cursor is not in 
the end of the words written (if shorter than length) but rather in 
"open" space. Can this behavior be changed (i.e. no padding)?

Should I use another method for "cursor limiting".

Any and all help is appreciated.
Technical Details
Message-ID: <427b9b4c$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!feed5.newsreader.com!newsreader.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,55b776b8137e1a73,start
X-Google-Attributes: gid111d45,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Fri, 06 May 2005 12:29:08 -0400
From: Magnus <magnus_bjorkman@iwon.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)
X-Accept-Language: en-us, en, sv
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing
Subject: Using MaskFormatter - flexible field length?
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.76.179.221
Message-ID: <427b9b4c$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1115396940 67.76.179.221 (6 May 2005 09:29:00 -0700)
Lines: 23
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!feed5.newsreader.com!newsreader.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!news-in.nuthinbutnews.com!news-in.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail