πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: JTextField Question

#10427
From: Tor Iver Wilhelmsen
Date: Mon, 27 Sep 1999 00:00
12 lines
898 bytes
"Michel PοΏ½rez" <mperez@eurobanco.com> writes:

> Does anybody know how to set a specific number of characters to be allowed
> by the JTextComponent ?

By making a PlainDocument subclass which overrides insertString() to
check length of the total (getText() plus the new text), and only
calls super.insertString() if the total is less than or equal to the
limit.

Set an instance of this class to the JTextComponent's document
property.
Technical Details
Message-ID: <ubtaobhtl.fsf@sds.no>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7snok1$a1n4@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 111d45,8f9acf093401c6af
X-Google-Attributes: gid111d45,public
From: Tor Iver Wilhelmsen <tor.wilhelmsen@sds.no>
Subject: Re: JTextField Question
Date: 1999/09/27
Message-ID: <ubtaobhtl.fsf@sds.no>
X-Deja-AN: 529863442
Sender: towi@SDSA1761
References: <7snok1$a1n4@forums.borland.com>
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.swing