Article View: borland.public.jbuilder.java.swing
Article #7615Re: Problem Controling Focus
From: Thorsten Deuter
Date: Mon, 08 Jan 2001 09:28
Date: Mon, 08 Jan 2001 09:28
23 lines
1757 bytes
1757 bytes
Nathan Bagby wrote:
>
...
> incorrect data, such as a bad date, the component.requestFocus() call
> fails and the next component gains focus. I obviously want focus to
> remain on the component where the incorrect data was entered...
I'm using a focus adapter for each input field and actually found
that invoking requestFocus directly did not help. Instead use:
SwingUtilities.invokeLater(
new Runnable(){
public void run() {
yourComponent.requestFocus();
}
});
Anyway I like Torsten's remark on this issue (setInputVerifier) which
probably
leads to less cluttered code.
cheers,
Thorsten
Technical Details
Message-ID:
<3A59882E.CC9F8866@graffinity.com>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsfeed.gamma.ru!Gamma.RU!newsfeed00.sul.t-online.de!t-online.de!newsfeeds.belnet.be!news.belnet.be!newsfeed.online.be!fr.clara.net!heighliner.fr.clara.net!news.imp.ch!news-zh.switch.ch!newsfeed-zh.ip-plus.net!news.ip-plus.net!bornews.borland.com!dnews!193.197.72.80References:
<3A5605DB.9D4F3AAB@nasirc.nasa.gov>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,d8a7625108df7ca1 X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2001-01-08 01:34:01 PST Message-ID: <3A59882E.CC9F8866@graffinity.com> Date: Mon, 08 Jan 2001 10:28:14 +0100 From: Thorsten Deuter <td@graffinity.com> Organization: Graffinity X-Mailer: Mozilla 4.7 [en] (WinNT; I) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing Subject: Re: Problem Controling Focus References: <3A5605DB.9D4F3AAB@nasirc.nasa.gov> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 193.197.72.80 X-Trace: 8 Jan 2001 01:29:08 -0800, 193.197.72.80 Lines: 23 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsfeed.gamma.ru!Gamma.RU!newsfeed00.sul.t-online.de!t-online.de!newsfeeds.belnet.be!news.belnet.be!newsfeed.online.be!fr.clara.net!heighliner.fr.clara.net!news.imp.ch!news-zh.switch.ch!newsfeed-zh.ip-plus.net!news.ip-plus.net!bornews.borland.com!dnews!193.197.72.80