🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Setting Focus Won't Work

#12365
From: Paul Waldo
Date: Thu, 14 Jan 1999 00:00
28 lines
1640 bytes
Yes, the requestFocus call is the last thing in the jbinit method, so it is
called much later after adding the component.

I have tried SwingUtilities.invokeLater() and I have also tried adding a window
listener to set the focus once the window is shown, all to no avail.

Paul

Matt Krevs wrote:

> Firstly, have you added userId to the Dialog before you do all the focus
> stuff?
>
> Usually, the component that will initially gain focus is the one that was
> added to the container first. Trying adding userId first and see what
> happens
>
> Secondly, requestDefaultFocus() doesnt work like its name suggests. Calling
> this method means that the component within a container that is the
> 'default' focus component will get the focus so calling this for a
> JTextField will do nothing ( ie there are no further components within the
> JTextField ).
>
> I have never had much luck with calling requestFocus() or grabFocus() unless
> I use SwingUtilities.invokeLater().
>
> Anyone out there know the ins and outs of focus management?
>
Technical Details
Message-ID: <369E44C5.D83364E2@bna.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <369CC78B.CABDD184@bna.com> <77j6j1$slg20@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,223cd5ce51a082af
X-Google-Attributes: gid111d45,public
From: Paul Waldo <pwaldo@bna.com>
Subject: Re: Setting Focus Won't Work
Date: 1999/01/14
Message-ID: <369E44C5.D83364E2@bna.com>
X-Deja-AN: 432633857
Content-Transfer-Encoding: 7bit
References: <369CC78B.CABDD184@bna.com> <77j6j1$slg20@forums.borland.com>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing