Article View: borland.public.jbuilder.java.swing
Article #12334Re: JTextField scrolls off screen
From: Alex B. Humphreys
Date: Fri, 22 Jan 1999 00:00
Date: Fri, 22 Jan 1999 00:00
41 lines
2030 bytes
2030 bytes
Thanks, but neither the validate nor the changing of alignment nor any
combination thereof helped.
Interestingly, I notice the problem only appears when I subclass JTextField
and assign the setText there (I'm setting a default for my NumJTextField of
0.00).
Any other possibilities?
Matt Krevs wrote:
> 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:
<36A8F818.31C32759@sema4.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<36A5F60D.CB3112E3@sema4.com> <785nt9$ek917@forums.borland.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: "Alex B. Humphreys" <ahumphreys@sema4.com> Subject: Re: JTextField scrolls off screen Date: 1999/01/22 Message-ID: <36A8F818.31C32759@sema4.com> X-Deja-AN: 435786815 Content-Transfer-Encoding: 7bit References: <36A5F60D.CB3112E3@sema4.com> <785nt9$ek917@forums.borland.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Semaphore, Inc. Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing