🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #8496

Re: Component focus in Swing is driving me nuts!

#8496
From: John P. McGrath
Date: Thu, 31 Aug 2000 00:00
24 lines
1408 bytes
On Tue, 29 Aug 2000 10:20:38 -0400, Gerald Nunn wrote:

> 2) In Windows, toolbar buttons don't get focus.
> Thus if you hit a "cut" button, it's easy to
> determine what control currently has focus and
> to pass the cut operation onto that control. How
> do I do the same in java?

There are two Swing properties that control whether or not a JComponent 
receives the focus.  In my experience, you have to make sure both return 
false to make sure that the component never receives focus.

isRequestFocusEnabled() controls whether a requestFocus() can be done on 
the component.  You can set this with setRequestFocusEnabled().

isFocusTraversable() controls whether the FocusManager will allow you to 
Tab to the component.  For some reason there is no setFocusTraversable() 
method.  In order to change this, you have to subclass the component and 
return the appropriate value.

-- 
Regards,

John McGrath
Technical Details
Message-ID: <MPG.1417cd6fb272130c989b0b@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <8ogg1s$du06@bornews.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,39449fb20ddb661e
X-Google-Attributes: gid111d45,public
From: John P. McGrath <JPMcGrath@fast.net>
Subject: Re: Component focus in Swing is driving me nuts!
Date: 2000/08/31
Message-ID: <MPG.1417cd6fb272130c989b0b@forums.borland.com>
X-Deja-AN: 664649195
References: <8ogg1s$du06@bornews.borland.com>
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.swing