Article View: borland.public.jbuilder.java.swing
Article #8728Re: How do i give focus to a JTextField
From: Joi Ellis
Date: Tue, 25 Jul 2000 00:00
Date: Tue, 25 Jul 2000 00:00
32 lines
1545 bytes
1545 bytes
Alexis Rios wrote:
>
> I want to do this in JBuilder
>
> Delphi code:
>
> procedure SetFocus;
> begin
> txtName.setFocus; (* I need something like this in Java *)
> end;
>
> It seems there isn't a method that is able to do that in Java or there is?
>
> Thanks
Every widget which descends from Swing's JComponent has a method
requestFocus().
so, textname.requestFocus() should do it.
http://java.sun.com/products/jdk/1.2/docs/api/javax/swing/JTextField.html#method_summary
http://java.sun.com/products/jdk/1.2/docs/api/javax/swing/JComponent.html#requestFocus()
--
Joi Ellis Software Engineer
Aravox Technologies joi@aravox.com, gyles19@visi.com
No matter what we think of Linux versus FreeBSD, etc., the one thing I
really like about Linux is that it has Microsoft worried. Anything
that kicks a monopoly in the pants has got to be good for something.
- Chris Johnson
Technical Details
Message-ID:
<397DBC81.5C430AB5@aravox.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<397db1f1_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,65225accd507e734 X-Google-Attributes: gid111d45,public From: Joi Ellis <joi@aravox.com> Subject: Re: How do i give focus to a JTextField Date: 2000/07/25 Message-ID: <397DBC81.5C430AB5@aravox.com> X-Deja-AN: 650594469 Content-Transfer-Encoding: 7bit References: <397db1f1_2@dnews> To: Alexis Rios <arios@netzeropr.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Aravox Technologies Mime-Version: 1.0 Reply-To: joi@aravox.com Newsgroups: borland.public.jbuilder.java.swing