Article View: borland.public.jbuilder.java.swing
Article #717Re: jTabbedPane focus problem
From: John T. Dow
Date: Tue, 04 Jan 2005 02:59
Date: Tue, 04 Jan 2005 02:59
70 lines
3348 bytes
3348 bytes
Arthur, your technique doesn't work for me, because
this.getContentPage() and validate() aren't defined. I've been working
with a state changed event, but I created a mouseClicked event as you
have and still no go.
The technique I've been trying is as follows. In the state changed
event, I request focus to the panel. When it gains focus, it requests
focus to the text field I want to ultimately have focus. I have output
statements that show this happening.
Thus, the text field gets focus, as I want.
But then it loses it. I have a focus lost event on the text field and
display getOppositeComponent and it goes to a text field that I haven't
defined. It doesn't display the name, only the coordinates and colors
etc, but the coordinates don't match anything I've created.
Except for focus going to this phantom jdbTextField, it works. But why
is it doing that, and what is the field?
I haven't trie the debugger, perhaps that will help.
John
Arthur Ore wrote:
> Hi John,
>
> I'm no expert on JTabbedPanes, but if I've understood what you are saying,
> I've just knocked up a quick bit of code and calling this.validate() or
> this.getContentPane().validate() seems to fix the problem you are describing
> depending on whether you are using a frame or an applet.
>
> Hence my code reads something like :-
>
> void jTabbedPane1_mouseClicked(MouseEvent e)
> {
> if (jTabbedPane1.getSelectedIndex()==2)
> {
> this.getContentPane().validate();
> jTextField3.requestFocus();
> }
>
> }
>
> Arth
>
>
> "John T. Dow" <john@johntdow.com> wrote in message
> news:41D99FA3.7060700@johntdow.com...
>
>>Further information on what I just posted.
>>
>>The component on the panel that is supposed to get focus does get focus,
>>but then loses it.
>>
>>So now the question is, where did the focus go?
>>
>>Also, to clarify, the component to get focus doesn't need to be the top
>>one on the panel. My earlier post may have been misleading on this point.
>>In the focusGained event for the panel, I'm specifying exactly which
>>component is to get focus.
>>
>>Thanks
>>
>>John
>>
>
>
>
Technical Details
Message-ID:
<41DA069C.3060608@johntdow.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!proxad.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<41D99FA3.7060700@johntdow.com> <41d9ade3@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,a0ad10712e673590 X-Google-Attributes: gid111d45,public X-Google-Language: ENGLISH,ASCII-7-bit Message-ID: <41DA069C.3060608@johntdow.com> Date: Mon, 03 Jan 2005 21:59:40 -0500 From: "John T. Dow" <john@johntdow.com> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing Subject: Re: jTabbedPane focus problem References: <41D99FA3.7060700@johntdow.com> <41d9ade3@newsgroups.borland.com> In-Reply-To: <41d9ade3@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 151.201.238.171 X-Trace: newsgroups.borland.com 1104807577 151.201.238.171 (3 Jan 2005 18:59:37 -0800) Lines: 71 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!proxad.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail