Can a Button refuse focus?

ngalarneau at ABINITIO.COM ngalarneau at ABINITIO.COM
Fri Nov 7 14:11:12 UTC 2014

To be clear, the blog writer did the best he could & acknowledged that the 
approach he was forced to take was fragile & incomplete.


From:   ngalarneau at ABINITIO.COM
To:     openjfx-dev at, 
Date:   11/07/2014 09:01 AM
Subject:        Can a Button refuse focus?
Sent by:        "openjfx-dev" <openjfx-dev-bounces at>

Can a control in JavaFX refuse focus?

Often you don't want buttons in a toolbar to receive focus.

Although the ToolBar javadoc states that focusTraversable is set to false, 

in Ensemble8, the buttons in the toolbar both are in the focus traversal 
cycle & receive focus when clicked on.

In this post (

) linked to from FX Experience, the fellow does a fragile & incomplete 
workaround for this problem.

Making the button not be focus traversable isn't good enough (if I 
understand it correctly), because the user could still click on the button 

& then it would take focus.

Node.isCanReceiveFocus() is, of course, not overridable, so that avenue is 




NOTICE from Ab Initio: This email (including any attachments) may contain 
information that is subject to confidentiality obligations or is legally 
privileged, and sender does not waive confidentiality or privilege. If 
received in error, please notify the sender, delete this email, and make 
no further use, disclosure, or distribution. 

More information about the openjfx-dev mailing list