🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: JTextFieldSize

#8059
From: Rich Wilkman
Date: Tue, 21 Nov 2000 00:00
39 lines
2327 bytes
James:

Do you want to limit the field to the entry of 50 characters or just the
display.  Joi has you covered for display, though you may have to
setText(50_M_CHARS) after the component is realized (i.e., is on the screen).
Also keep in mind that you can setPreferredSize to your hearts content but a
layout manager doesn't have to honor it.  I'd take the approach of extending
JTextField and overriding getPreferredSize(), myself.

If you want to limit entry then you need to write some additional code to plug
in to the JTextField (or your extension).

Also, you want 50 monospaced characters.  You don't say at what point size you
want them to fit.  50 22pt characters takes more than 50 8pt characters.  Also
remember that after going through all this pain and suffering and having it not
work the same between browsers that the user can simply have font settings
selected for their OS or Browser that simply don't work in your model.

What are you trying to accomplish?  Right now it just seems to be some
masochistic effort to bring forward a 70's style database approach for a adm3a
terminal.

-Rich

"James A. Schulz" wrote:

> I want a JTextField that will accomodate exactly 50 Monospaced characters.
> I set the "Columns" property to 50, but that doesn't seem to have any effect
> because I can enter more than 50 characters and the dimensions of the field
> give it much more width than it needs.
>
> I know that fonts are variable from platform to platform, but this app
> requires a precise size for this field.  Is my only strategy to determine
> the font character width at run time and then resize my entire applet?
> Please tell me there is an easier way.
>
> thanks,
>
> James
Technical Details
Message-ID: <3A1B0339.BFF34050@formlessvoid.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <8vemot$qj46@bornews.inprise.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,69aa350fde3e11dc
X-Google-Attributes: gid111d45,public
From: Rich Wilkman <richw@formlessvoid.com>
Subject: Re: JTextFieldSize
Date: 2000/11/21
Message-ID: <3A1B0339.BFF34050@formlessvoid.com>
X-Deja-AN: 696362911
Content-Transfer-Encoding: 7bit
References: <8vemot$qj46@bornews.inprise.com>
X-Accept-Language: ja,en
Content-Type: text/plain; charset=us-ascii
X-Trace: 21 Nov 2000 15:21:50 -0800, 209.144.169.10
MIME-Version: 1.0
Reply-To: richw@formlessvoid.com
Newsgroups: borland.public.jbuilder.java.swing