Article View: borland.public.jbuilder.java.swing
Article #7657Re: JButton and Focus Question
From: Sonny Soriano
Date: Wed, 20 Dec 2000 13:50
Date: Wed, 20 Dec 2000 13:50
25 lines
1590 bytes
1590 bytes
I'm not sure if this is the best solution. You can trap the focus event on
the button ( implement FocusListener ) then make your default focus
component grab the keyboard focus ( requestFocus() ) whenever the button
receives it.
Sonny
James A. Schulz <jaschulz@wiseware.com> wrote in message
news:91qbm2$7ug5@bornews.inprise.com...
> What is the right way to prevent a JButton from ever receiving the focus.
I
> have tried setting requestFocusEnabled to FALSE, but that doesn't work. I
> also tried adding the following to my code:
>
> myJButton.isFocusTraversable(){
> return false;
> }
>
> but that doesn't do anything either.
>
> I'm stuck. Can anyone help?
>
> James
>
>
Technical Details
Message-ID:
<3a40b9a6_1@dnews>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!neel.uni2.net!newssuck.uni2.dk!bornews.borland.com!dnews!203.169.80.129References:
<91qbm2$7ug5@bornews.inprise.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,d51577e542f3b18b X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2000-12-20 05:55:43 PST From: "Sonny Soriano" <sonny_jean@pacific.net.sg> Newsgroups: borland.public.jbuilder.java.swing References: <91qbm2$7ug5@bornews.inprise.com> Subject: Re: JButton and Focus Question Date: Wed, 20 Dec 2000 21:50:06 +0800 Lines: 27 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 NNTP-Posting-Host: 203.169.80.129 Message-ID: <3a40b9a6_1@dnews> X-Trace: 20 Dec 2000 05:52:38 -0800, 203.169.80.129 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!neel.uni2.net!newssuck.uni2.dk!bornews.borland.com!dnews!203.169.80.129