Article View: borland.public.jbuilder.java.swing
Article #13121Re: Where is focus?
From: Paul Furbacher
Date: Thu, 24 Sep 1998 00:00
Date: Thu, 24 Sep 1998 00:00
20 lines
1284 bytes
1284 bytes
Guy Scharf wrote: > > I have created a JDialog with three JButtons and two JLabels on it. > This is a simple dialog to ask the user to make a choice. > > When the dialog is displayed, where is the focus? If I press the Tab > key, focus moves to the first button. But I would prefer that it be on > the first button to begin with. How do I make that happen? > > I am running JBuilder 2 and Swing 1.0.3. Take a look at how JOptionPane does it -- notably the calls to "setInitialValue()" and "selectInitialValue()" in "showOptionDialog()". Or you could try a "requestFocus()", but that supposedly doesn't work until the component is visible. Paul Furbacher
Technical Details
Message-ID:
<360B0D63.A905B78A@bilbo.bio.purdue.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<360AB611.1D3BB742@swarc.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,1f6f9d6585b5c186 X-Google-Attributes: gid111d45,public From: Paul Furbacher <pf@bilbo.bio.purdue.edu> Subject: Re: Where is focus? Date: 1998/09/24 Message-ID: <360B0D63.A905B78A@bilbo.bio.purdue.edu> X-Deja-AN: 394604948 Content-Transfer-Encoding: 7bit References: <360AB611.1D3BB742@swarc.com> To: Guy Scharf <guy@swarc.com> Content-Type: text/plain; charset=us-ascii Organization: Biological Sciences, Purdue Univ. Mime-Version: 1.0 Reply-To: pf@bilbo.bio.purdue.edu Newsgroups: borland.public.jbuilder.java.swing