🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: JTextField scrolls off screen

#12321
From: Matt Krevs
Date: Thu, 21 Jan 1999 00:00
30 lines
1579 bytes
Just an idea

What happens if you call validate() for the container of the JTextField
after calling setText(). You shouldnt have to do this but I wonder what
effect it would have.

Another thing to try would be to change the alignment to LEFT, call
setText() and then reset the alignment to RIGHT.

Alex B. Humphreys wrote in message <36A5F60D.CB3112E3@sema4.com>...
>I have a class called NumJTextField that extends JTextField.  The code
>follows:
>
>public NumJTextField() {
>    setMargin(new Insets(2, 2, 2, 2));
>    setHorizontalAlignment(JTextField.RIGHT);
>}
>
>Problem is, when I setText on the textfield in my code, it appears
>hidden behind the left side of the field.  I can manually scroll the
>field over and see my code, but this is of course unacceptable.  Any
>ideas why the field doesn't setText in a clean manner?  If it's
>important, I have the textFields expanding as needed using a
>GridBagLayout and I reassign the value of the textFields many times
>(repainting doesn't seem to help after each assignment).
>
>Thanks.
>
>Alex
>
Technical Details
Message-ID: <785nt9$ek917@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36A5F60D.CB3112E3@sema4.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,21cc40309718ce26
X-Google-Attributes: gid111d45,public
From: "Matt Krevs" <mattkrevs@flex.com.au>
Subject: Re: JTextField scrolls off screen
Date: 1999/01/21
Message-ID: <785nt9$ek917@forums.borland.com>
X-Deja-AN: 434999689
References: <36A5F60D.CB3112E3@sema4.com>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.swing