How to layout textfields and keep size at 1 character height
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
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.
Re: How to layout textfields and keep size at 1 character height
On Sat, 10 Apr 2004 13:48:16 -0400, Jim wrote:
> 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?
> Putting the textfield on its own JPanel keeps the textfield a constant size
> but this seems like overkill.
??? What's dead?
BorderLayout, JPanel with GridLayout in WEST
for JLabels, JPanel with GridLayout in EAST
The JLabels get as much space as they need,
the TextFields get the rest.
If you do not like the fact that this design
_too_ can increase greater then 1 char height,
wack the entire assenblage in the NORTH area
of a second BorderLayout.
...If you are especially against nested Layouts,
you might check out the JGoodies FormLayout,
which as I understand is specialized for just
this type of situation. No JPanels need 'die'. ;-)
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
|All times are GMT. The time now is 02:56 AM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.