Article View: borland.public.jbuilder.java.swing
Article #261Re: requestFocus and JTextField
From: Bruce Houghtron
Date: Tue, 12 Jun 2007 21:07
Date: Tue, 12 Jun 2007 21:07
40 lines
2577 bytes
2577 bytes
Damit your good. Thanks allot, I've been fighting this problem for a long time. Now I can also fix my Login screen. The customer always asked why I couldn't put the cursor in the Password Field on the Login screen Thanks again... Bruce Houghton "Kevin Dean [TeamB]" <NkOdSePaAnM@datadevelopment.com> wrote in message news:xn0f7d6r7cpko2001-kdean@www.teamb.com... > Bruce Houghtron wrote: > >>I'll be dammed if I can get Focus on a JTextField at Load Time. >>I've tried everything(it seems). requestFocus, requestFocusInWindow, >>requestFocus(true).... >>I have two JDialog's, one with a JList, and one without. The one without >>works fine. One of the symptoms is that when I key something in, just >>after load time, I >>get an "valueChanged" from the ListSelectionListener. >> >>I put a "requestFocus()" then a getFocusOwner() after the init is >>complete. The >>getFocusOwner() shows "null". >>Like I say, it seems as if I have tried everything and read everything I >>can get >>my hands on... So far no luck.. > > The problem is that requesting focus is a window event and the window > object hasn't been created yet. Initializing a dialog or a frame creates > only the Java objects, not the window handle. > > Try hooking into the "componentShown" event on the window and requesting > focus at that point. > > -- > Kevin Dean [TeamB] > Dolphin Data Development Ltd. > http://www.datadevelopment.com/ > > Please see Borland's newsgroup guidelines at > http://info.borland.com/newsgroups/guide.html
Technical Details
Message-ID:
<466f0af5$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<466ec402$2@newsgroups.borland.com> <xn0f7d6r7cpko2001-kdean@www.teamb.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,cd79719f41c7c23a X-Google-Attributes: gid111d45,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Reply-To: "Bruce Houghtron" <bhought@globalserve.net> From: "Bruce Houghtron" <bhought@globalserve.net> Newsgroups: borland.public.jbuilder.java.swing References: <466ec402$2@newsgroups.borland.com> <xn0f7d6r7cpko2001-kdean@www.teamb.com> Subject: Re: requestFocus and JTextField Date: Tue, 12 Jun 2007 17:07:10 -0400 Lines: 42 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3028 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-RFC2646: Format=Flowed; Response NNTP-Posting-Host: 207.112.93.126 Message-ID: <466f0af5$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1181682421 207.112.93.126 (12 Jun 2007 14:07:01 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail