🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

How to keep textfield size at 1 character height

#1126
From: Jim
Date: Sun, 11 Apr 2004 15:07
25 lines
1781 bytes
I'm trying to layout a series pairs of labels (JLabel) and text fields
(JTextfield) for a form.

Is there an easy way of doing this and constraining the height of the
textfield to be 1 character height?
Ideally, I could just plunk down a text field and have it be the right
height (with a border would be nice) regardless of its container and layout
style.

I've tried a 2-column grid with labels on the left and textfields on the
right and the textfield gets resized
whenever the grid is resized.  Trying two side-by-side panels with vertical
box layouts doesn't work either.

Putting the textfield on its own JPanel keeps the textfield a constant size
but this seems like overkill.

Is subclassing a JTextfield (or a JPanel with JTextfield) so I don't have
set each one up individually a solution?

I'm using JBuilder Foundation IDE.

Thanks for your suggestions.

Jim Cant
Technical Details
Message-ID: <40795f4d$0$27641$61fed72c@news.rcn.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!border1.nntp.ash.giganews.com!nntp.giganews.com!diablo.voicenet.com!nntp.abs.net!rcn!feed3.news.rcn.net!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,f6fe63ed057abf9c,start
X-Google-Attributes: gid111d45,public
X-Google-ArrivalTime: 2004-04-11 08:07:58 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!border1.nntp.ash.giganews.com!nntp.giganews.com!diablo.voicenet.com!nntp.abs.net!rcn!feed3.news.rcn.net!not-for-mail
From: "Jim" <cant_jim@hotmail.com>
Newsgroups: borland.public.jbuilder.java.swing
Subject: How to keep textfield size at 1 character height
Date: Sun, 11 Apr 2004 11:07:45 -0400
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Lines: 27
Message-ID: <40795f4d$0$27641$61fed72c@news.rcn.com>
X-Trace: DXC=^Hf3VHXVU4CXRnZBHDoMYH0R]m=BkYWIG:6bU3OT9S9JY2o:<1ZIMGMPP;4eDdI1VAXn^VE>h=8<L
X-Complaints-To: abuse@rcn.com