Article View: borland.public.jbuilder.java.swing
Article #8411Re: How to setFocus on a jTextField
From: Dan Reading
Date: Tue, 19 Sep 2000 00:00
Date: Tue, 19 Sep 2000 00:00
25 lines
1307 bytes
1307 bytes
Focus can be a bitch in Swing. I've fought with it a lot and I think it
comes down to the order in which things happen - you have to get the
execution thread to ask for the focus last thing. Request the focus at the
end of your thread like this:
SwingUtilities.invokeLater(new Runnable() {
public void run() { jTextField.requestFocus();}
});
"Jay Gunderson" <jay.gunderson@concert.com> wrote in message
news:8povvk$7ln2@bornews.borland.com...
> From jFrame1 I do:
>
> JFrame2 jframe2 = new jFrame2();
> jframe2.jTextField1.requestFocus();
>
> Result is that jTestField1 does not get the focus. I have also tried
> setting focus after setVisible in JFrame2, to no avail. Is there some
> way to setfocus?
> Thanks,
> Jay Gunderson
>
>
Technical Details
Message-ID:
<39c7dd0e_2@dnews>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<8povvk$7ln2@bornews.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,a2771b435264731c X-Google-Attributes: gid111d45,public From: "Dan Reading" <dreading@chelseasystems.com> Subject: Re: How to setFocus on a jTextField Date: 2000/09/19 Message-ID: <39c7dd0e_2@dnews> X-Deja-AN: 671793319 References: <8povvk$7ln2@bornews.borland.com> X-Trace: 19 Sep 2000 14:39:26 -0800, 198.64.204.34 X-MSMail-Priority: Normal X-Priority: 3 Newsgroups: borland.public.jbuilder.java.swing X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400